php form coding, passing fields?

  • Thread starter Thread starter Mr E
  • Start date Start date
M

Mr E

Guest
what on earth is wrong with this code.

it does absolutely everything BUT post the details

what it does: basicaly this code displays all doors in a range from name. it displays the price break down the image and the name
what i.

want it to do is pass on the final price the door name the quantity to the shopping basket page, then work out the price with the quantity to give the final price and also price up all the doors that get bought (obviously meaning if you navigate away from the page and go to re order it will keep it there until you want to buy the door) obviously i'll need a delete order button but thats not scripted in so if in your answer you give me a method of doing this i'd be very happy. but anyway this is my code for the door selection page or the part you need:


$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}


// some code
echo '<form action="basket.php" method="post">';
// gathers the door name the final price and the thumbnail for all doors that have Arbury in their name
$sql = mysql_query("SELECT DoorName, Thumbimage,OurListPrice,ListPrice50Percdisc, VAT, InternetDiscount10Perc FROM tblpricelist WHERE DoorName like '%Kenilworth%'");

$cln = 0;
echo ("<table>");
echo ("<tr>");
while ($row = mysql_fetch_array($sql))
{
echo ("<th align=\"center\">");

$id = $row['DoorName'];

echo" <img src='./thumb/". $row['Thumbimage']."' onclick=\"this.src='./large/". $row['Thumbimage']."'\" ondblclick=\"this.src='./thumb/". $row['Thumbimage']."'\"/><br />";
echo $row['DoorName']."<br/>";
echo "full price: £".$row['OurListPrice']."<br/>";
echo "50% discount: £". $row['ListPrice50Percdisc']."<br/>";
echo "We pay the VAT: £". $row['VAT']."<br/>";
echo "and with our online discount you will pay: £".$row['InternetDiscount10Perc']."<br/>";
echo "quantity:";
echo "<INPUT type='text' name='doorqty' size=2 maxlength=2>";
echo "<input type='submit' value='order now' />";

echo "</th>";

$cln++;
if ($cln == 4)
{
$cln = 0;
echo ("</tr>\n<tr>");
}
}

echo "</form>";
echo ("</tr>");
echo ("</table>");


?>
</div>
</div>

<div id="info">
<?php
echo "click the doors to enlarge image" ."<br/>" . "double click to return to thumb size";
?>
</div>
</div>

________________________________________________________

this is the part for the the shopping basket page:



<div id="MainContent">
<div id = "productform">
<?php



echo $_GET [$row['DoorName']];
echo $_GET [$row['InternetDiscount10Perc']];
echo $_post["doorqty"];
echo "<input type='text' name='doortotal' size='12' onchange='calculate()'>";


?>

</div>
<div id="detailsform">
<form action="/cgi-bin/FormMail.pl" method="POST">

<p>Forename:<INPUT type='text' name='forename' size=20 maxlength=20></p>
<p>Surname:<INPUT type='text' name='surname' size=20 maxlength=20></p>
<p>Address Line 1:<INPUT type='text' name='address1' size=20 maxlength=20></p>
<p>Address Line 2:<INPUT type='text' name='address2' size=20 maxlength=20></p>
<p>Address Line 3:<INPUT type='text' name='address3' size=20 maxlength=20></p>
<p>Post Code:<INPUT type='text' name='postcode' size=8 maxlength=8></p>
<p>E-Mail Address:<INPUT type='text' name='email' size=20 maxlength=20></p>
<p>Bank Account Number:<INPUT type='text' name='banknumber' size=15 maxlength=15></p>
<p>Issue Number:<INPUT type='text' name='issue' size=2 maxlength=2></p>
<p>Expiry Date:<INPUT type='text' name='expirydatemonth' size=2 maxlength=2>/<INPUT type='text' name='expirydateyear' size=2 maxlength=2></p>
</form>
</div>
</div>


i'm getting quite desperate for answers this project has taken me ages
 
$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}


// some code
echo '<form action="basket.php" method="post">';
// gathers the door name the final price and the thumbnail for all doors that have Arbury in their name
$sql = mysql_query("SELECT DoorName, Thumbimage,OurListPrice,ListPrice50Percd... VAT, InternetDiscount10Perc FROM tblpricelist WHERE DoorName like '%Kenilworth%'");

$cln = 0;
echo ("<table>");
echo ("<tr>");
while ($row = mysql_fetch_array($sql))
{
echo ("<th align=\"center\">");

$id = $row['DoorName'];

echo" <img src='./thumb/". $row['Thumbimage']."' onclick=\"this.src='./large/". $row['Thumbimage']."'\" ondblclick=\"this.src='./thumb/". $row['Thumbimage']."'\"/>
";
echo $row['DoorName']."<br/>";
echo "full price: £".$row['OurListPrice']."<br/>";
echo "50% discount: £". $row['ListPrice50Percdisc']."<br/>";
echo "We pay the VAT: £". $row['VAT']."<br/>";
echo "and with our online discount you will pay: £".$row['InternetDiscount10Perc']."<br/>...
echo "quantity:";
echo "<INPUT type='text' name='". echo $row['DoorName'] . "' size=2 maxlength=2>";

echo "</th>";

$cln++;
if ($cln == 4)
{
$cln = 0;
echo ("</tr>\n<tr>");
}
}

echo "<center><input type='submit' value='order now' /></center>";
echo "</form>";
echo ("</tr>");
echo ("</table>");


?>
</div>
</div>

<div id="info">
<?php
echo "click the doors to enlarge image" ."<br/>" . "double click to return to thumb size";
?>
</div>
</div>

_________________________________

<div id="MainContent">
<div id = "productform">
<?php

$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

$sql = mysql_query("SELECT DoorName, OurListPrice FROM tblpricelist WHERE DoorName like '%Kenilworth%'");

//the door names are the text field names
//we'll use them to get the post data
$count = 0;
while ($row = mysql_fetch_array($sql))
{
$a[$count++] = $_POST[$row['DoorName']];
}

//now you have a list with the quantity of each door, respectively.
//just to show you
for($i = 0; $i < sizeof($a); $i++)
{
echo $a[$i];
}

?>

</div>
</div>
 
Back
Top