HighDots Forums  

Dreamweaver MX templates and php

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Dreamweaver MX templates and php in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
taffuk
 
Posts: n/a

Default Dreamweaver MX templates and php - 01-01-2006 , 12:53 PM






I have a site based on template (DWMX). I had a store built using php by
somebody else; the store pages use the template. I did a site design change a
few days back and updated the template but now the store does not work. I
could go back to the guy who built the shop but he will charge to look through
the code. I thought I woudld check first to see if anyone has experienced a
similar problem and can help me out.

The actual problem is when you enter a qty in the orderform and click order
the information is not carried through to the checkout page
http://www.saferpak.com/orderform.php


Thanks,
Simon


Reply With Quote
  #2  
Old   
SnakEyez
 
Posts: n/a

Default Re: Dreamweaver MX templates and php - 01-01-2006 , 01:08 PM






Unfortunately PHP source code cannot be viewed over the internet using PHP pages. Could you post your source code?

Reply With Quote
  #3  
Old   
taffuk
 
Posts: n/a

Default Re: Dreamweaver MX templates and php - 01-01-2006 , 03:45 PM



Code for the two pages follows:

Thanks for your help.
Simon

http://www.saferpak.com/orderform.php

<?php
include("connect.php");
?>


<form name="form1" id="form1" method="post" action="checkout.php"><input
name="BasketID" type="hidden" value="<?php echo $BasketID; ?>" />
<?php
$SQL = "SELECT ProductID,Quantity FROM BasketContents WHERE BasketID =
'".$BasketID."'";
$bres = mysql_query($SQL);
$brows = mysql_numrows($bres);
$SQL = "SELECT * FROM Products ORDER BY ProductID";
$ares = mysql_query($SQL);
$arows = mysql_numrows($ares);
for($a=0;$a<$arows;$a++){
$quantity = 0;
for($b=0;$b<$brows;$b++){
if(mysql_result($ares,$a,"ProductID") ==
mysql_result($bres,$b,"ProductID")){
$quantity = mysql_result($bres,$b,"Quantity");
}
}
?>
<table width="100%" border="0" cellpadding="6" cellspacing="1"
class="quickborder">
<tr valign="top" bgcolor="#EEEEEE" class="productsborder">
<td colspan="3"> <p><span class="productstitle"><?php echo
htmlspecialchars(mysql_result($ares,$a,"Title")); ?><br />
</span><span class="productsub"><?php echo
htmlspecialchars(mysql_result($ares,$a,"TitleIntro ")); ?></span> </p></td>
</tr>
<tr valign="top" bgcolor="#F5F5F5" class="productsub">
<td width="20%">&nbsp;</td>
<td width="50%"><strong>Specification</strong></td>
<td width="30%"><strong>Prices</strong></td>
</tr>
<tr valign="top" bgcolor="#F9F9F9" class="productsbody">
<td height="137" bgcolor="#F9F9F9"> <p align="center">
<?php
if(trim(mysql_result($ares,$a,"Filename")) <> ""){
?>
<img src="uploads/<?php echo mysql_result($ares,$a,"Filename"); ?>"
alt="<?php echo htmlspecialchars(mysql_result($ares,$a,"Title")); ?>"
border="0" />
<?php
}
?></p></td>
<td bgcolor="#F9F9F9"><?php echo
nl2br(htmlspecialchars(mysql_result($ares,$a,"Spec ification"))); ?><br />
<br />
<br />
<a href="<?php echo mysql_result($ares,$a,"URL"); ?>"
target="_blank"><?php echo mysql_result($ares,$a,"LinkText"); ?></a> </td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="productsbodyalternate">
<td>Quantity<br /> </td>
<td>Price</td>
</tr>
<?php if(mysql_result($ares,$a,"Price20") <>
mysql_result($ares,$a,"Price1")){ ?>
<tr class="productsbodyalternate">
<td>1-19 </td>
<td>&pound;<?php echo mysql_result($ares,$a,"Price1"); ?>
each</td>
</tr>
<tr class="productsbodyalternate">
<td>20-99</td>
<td>&pound;<?php echo mysql_result($ares,$a,"Price20"); ?>
each</td>
</tr>
<tr class="productsbodyalternate">
<td>100 +</td>
<td>&pound;<?php echo mysql_result($ares,$a,"Price100"); ?>
each</td>
</tr>
<?php
}else{
?>
<tr class="productsbodyalternate">
<td>1+ </td>
<td>&pound;<?php echo mysql_result($ares,$a,"Price1"); ?>
each</td>
</tr>
<?php
}
?>
<tr class="productsbodyalternate">
<td height="23">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr class="productsbodyalternate">
<td height="28">Quantity</td>
<td><input name="quantity<?php echo
mysql_result($ares,$a,"ProductID"); ?>" type="text"
class="productsbodyalternate" id="quantity<?php echo
mysql_result($ares,$a,"ProductID"); ?>" value="<?php echo $quantity; ?>"
size="4" maxlength="4" /></td>
</tr>
</table>
<p class="productsbodyalternate">
<input name="imageField" type="image" src="images/buy2.gif"
width="57" height="30" border="0" />
</p></td>
</tr>
</table>
<p>&nbsp;</p>
<p><br />
<?php } ?>
</p>
</form>


*******************************
http://www.saferpak.com/checkout.php


<?php
include("connect.php");
if($addupp < 1){
if($BasketID > 0){
$SQL = "DELETE FROM BasketContents WHERE BasketID = '".$BasketID."'";
$junk = mysql_query($SQL);
}else{
$SQL = "INSERT INTO Basket(BasketID)VALUES('')";
$junk = mysql_query($SQL);
$BasketID = mysql_insert_id();
}
setcookie("BasketID",$BasketID);
}
if($addupp < 1){
$SQL = "SELECT ProductID FROM Products";
$ares = mysql_query($SQL);
$arows = mysql_numrows($ares);
$thisday = date("Y-m-d");
for($a=0;$a<$arows;$a++){
$numitems = "quantity".mysql_result($ares,$a,"ProductID");
if($$numitems > 0){
$SQL = "INSERT INTO
BasketContents(BasketID,ProductID,Quantity,ItemDat e)VALUES('".$BasketID."','".my
sql_result($ares,$a,"ProductID")."','".$$numitems. "','".$thisday."')";
$junk = mysql_query($SQL);
}
}
}
?>



<form name="form1" id="form1" method="post" action="orderform.php">
<input name="BasketID" type="hidden" value="<?php echo $BasketID; ?>"
/>
<table width="100%" border="0" cellpadding="6" cellspacing="1"
class="quickborder">
<tr valign="top" bgcolor="#F5F5F5" class="productsub">
<td width="385" align="left">Item</td>
<td width="53"><strong>Quantity</strong></td>
<td width="142"><strong>Unit Cost</strong></td>
<td width="66">Sub Total</td>
</tr>
<?php
$SQL = "SELECT Title,Price1,Price20,Price100,Quantity FROM
BasketContents,Products WHERE Products.ProductID = BasketContents.ProductID AND
BasketID = '".$BasketID."'";
$ares = mysql_query($SQL);
$arows = mysql_numrows($ares);
for($a=0;$a<$arows;$a++){
if(mysql_result($ares,$a,"Quantity") < 20){
$itemprice = mysql_result($ares,$a,"Price1");
$subtotal = mysql_result($ares,$a,"Price1") *
mysql_result($ares,$a,"Quantity");
}else{
if(mysql_result($ares,$a,"Quantity") > 99){
$itemprice = mysql_result($ares,$a,"Price100");
$subtotal = mysql_result($ares,$a,"Price100") *
mysql_result($ares,$a,"Quantity");
}else{
$itemprice = mysql_result($ares,$a,"Price20");
$subtotal = mysql_result($ares,$a,"Price20") *
mysql_result($ares,$a,"Quantity");
}
}
$total = $total + $subtotal;
$vat = $total * 0.175;
?>
<tr valign="top" bgcolor="#F9F9F9" class="productsbody">
<td align="left" bgcolor="#F9F9F9"><?php echo
htmlspecialchars(mysql_result($ares,$a,"Title")); ?></td>
<td align="right" bgcolor="#F9F9F9"><?php echo
mysql_result($ares,$a,"Quantity"); ?></td>
<td align="right">&pound;<?php echo number_format($itemprice, 2,
'.', ''); ?></td>
<td align="right">&pound;<?php echo number_format($subtotal, 2,
'.', ''); ?></td>
</tr>
<?php } ?>
<tr valign="top" bgcolor="#F9F9F9" class="productsbody">
<td bgcolor="#F9F9F9"> </td>
<td bgcolor="#F9F9F9">&nbsp;</td>
<td align="left" class="productsub">Total</td>
<td align="right">&pound;<?php echo number_format($total, 2, '.',
''); ?></td>
</tr>
<tr valign="top" bgcolor="#F9F9F9" class="productsbody">
<td bgcolor="#F9F9F9"> </td>
<td bgcolor="#F9F9F9">&nbsp;</td>
<td align="left" class="productsub">VAT (if applicable)</td>
<td align="right">&pound;<?php echo number_format($vat, 2, '.',
''); ?></td>
</tr>
<tr valign="top" bgcolor="#F9F9F9" class="productsbody">
<td bgcolor="#F9F9F9"> </td>
<td bgcolor="#F9F9F9">&nbsp;</td>
<td align="left" class="productsub">Total + VAT</td>
<td align="right">&pound;<?php echo number_format(($total + $vat),
2, '.', ''); ?></td>
</tr>
</table>
<br />
<input name="imageField" type="image" src="images/backshop.gif"
border="0" />
</form>
<form name="form2" id="form2" method="post" action="checkout2.php">
<table width="100%" border="0" cellpadding="6" cellspacing="1"
class="quickborder">
<tr align="left" valign="top" bgcolor="#F5F5F5" class="productsub">
<td>Name</td>
<td> <input name="name" type="text" class="productsbody" id="name"
value="<?php echo $name; ?>" size="50" maxlength="200" />
</td>
</tr>
<tr align="left" valign="top" bgcolor="#F5F5F5" class="productsub">
<td>Company</td>
<td> <input name="company" type="text" class="productsbody"
id="company" value="<?php echo $company; ?>" size="50" maxlength="200" /></td>
</tr>
<tr align="left" valign="top" bgcolor="#F5F5F5" class="productsub">
<td>Address</td>
<td> <textarea name="address" cols="50" rows="5"
class="productsbody" id="address"><?php echo $address; ?></textarea></td>
</tr>
<tr align="left" valign="top" bgcolor="#F5F5F5" class="productsub">
<td>Postcode</td>
<td> <input name="postcode" type="text" class="productsbody"
id="postcode" value="<?php echo $postcode; ?>" size="10" maxlength="20" /></td>
</tr>
<tr align="left" valign="top" bgcolor="#F5F5F5" class="productsub">
<td>Country</td>
<td> <select name="country" id="country" class="productsbody">
<option value="0">Please Select</option>
<?php
$SQL = "SELECT CountryID,CountryName FROM Countries WHERE AreaID > 0 ORDER
BY CountryName";
$cres = mysql_query($SQL);


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.