Forum Moderators: coopster
I want that is does the following display the product and the qty of all filled in products i`ll already try it whith an array and some counters but that didn`t worked maybe I was doing something wrong. I hope someone have a suggestion
I have the following code so far:
Bestellunch.php
<HTML>
<HEAD>
<TITLE>Bon Keurslager</TITLE>
<BASE TARGET="Midden">
<LINK HREF="Style\Style.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY>
<!--Hier komt de tekst-->
<!-- Starts the worstjes list -->
<FORM METHOD=POST ACTION="Besteldl.php">
<DIV CLASS=KOP>Lunchverzorging</DIV>
<?php $lijst1 = "Worstjes";?>
<TABLE CLASS=Tekst>
<TR>
<TD CLASS=Lijst>"<?php echo $lijst1?>"</TD><!-- declare lijst1 -->
</TR>
<TR>
<TD CLASS=Menu>Productomschrijving</TD>
<TD CLASS=Menu>Stuks</TD>
</TR>
<?PHP
$pi = 0;
$products = array();
mysql_select_db("keurslager"); //This connects to the databse again
$result = mysql_query("SELECT * FROM products WHERE productcategory = '$lijst1' ORDER BY productdescription DESC, productpriceone ASC");//This give the result of all products of lijst1 remeber lijst1 is decalred before
if(!$result)error_message(sql_error());//Gives a friendly error if there is something wrong
for($i = mysql_num_rows($result)-1; $i >=0; $i--)//for each row above 0
{
echo"<TR>",//This displays a table with product information
"<TD>","<INPUT TYPE='hidden' NAME='product$pi' VALUE=",mysql_result($result, $i, "productdescription"),">",mysql_result($result, $i, "productdescription"),"</TD>",
"<TD>","<INPUT TYPE='text' NAME='aantal$pi' SIZE='1'>", "</TD>";
array_push($products, $product."~".$aantal0);
$pi += 1;
}
echo $pi;
?>
<INPUT TYPE="hidden" VALUE="<? echo $products;?>" NAME="products">
<TR>
<TD><HR></TD>
<TD><HR></TD>
</TR>
<!-- End worstjes list -->
</TABLE>
<INPUT TYPE="submit" VALUE='Bestel'>
</FORM>
<!--Einde tekstvak-->
</BODY>
</HTML>
<!-- This is where the bestel lunch is going -->
Besteldl
<HTML>
<HEAD>
<TITLE>Bon Keurslager</TITLE>
<BASE TARGET="Midden">
<LINK HREF="Style\Style.css" REL="stylesheet" TYPE="text/css">
</HEAD>
<BODY>
<!--Hier komt de tekst-->
<?
//echo $nummer;
//echo $product0," ", $aantal0;
$products = array();
array_push($products, $product0."~".$aantal0);
print_r ($products);
$products= explode("~",$products);
echo $products[0]
?>
<!--Einde tekstvak-->
</BODY>
</HTML>
<!-- This is a sort of template these are the standard things to make a default file -->