...

View Full Version : Using variables to find postback information



dmarket
02-23-2010, 03:02 PM
So I have made an online bread order form. Basically the type of bread, the price, and a quantity box is generated from a mysql database. From there the user hits order and it is processed.

What I am trying to do is generate a receipt for the user so they can review what they ordered. So I have once again generated another dynamic table - however this time I want the quantity textbox to get the postback values from the quantity textbox on the page before. I was trying something like this:

<?php $count = 0; do {
$count = $count + 1;
$breadq = "breadq" + $count;
?>

Than heres the column with the quanitity textbox

<td bgcolor="#FFFFCC"><span style="border-bottom-style: solid; border-bottom-width: 1px"> Qty</span><span style="border-bottom-style: solid; border-bottom-width: 1px">
<input name="qty" id="qty" value="<?php echo $_POST["breadq"+$count]; ?>" size="7" />
</span></td>


Any suggestions? Heres the entire code for the table

<table border="0" cellpadding="0" cellspacing="3">

<?php $count = 0; do {
$count = $count + 1;
$breadq = "breadq" + $count;
?>
<tr>
<td width="171" align="right" bgcolor="#FFFFCC"><span style="border-bottom-style: solid; border-bottom-width: 1px"> <span style="text-align: left"></span>
<input name="breadb<?php echo $row_bread['ID']; ?>" readonly="True" id="breadb[]" value="<?php echo $row_bread['bread']; ?>" size="20" />
</span><br />
<span class="small"><?php echo $row_bread['notes']; ?></span></td>
<td bgcolor="#FFFFCC">$<span style="border-bottom-style: solid; border-bottom-width: 1px">
<input name="breadp<?php echo $row_bread['ID']; ?>" readonly="True" id="breadp[]" value="<?php echo $row_bread['price']; ?>" size="3" />
</span></td>
<td bgcolor="#FFFFCC"><span style="border-bottom-style: solid; border-bottom-width: 1px"> Qty</span><span style="border-bottom-style: solid; border-bottom-width: 1px">
<input name="qty" id="qty" value="<?php echo $_POST["breadq"+$count]; ?>" size="7" />
</span></td>
<td width="61" bgcolor="#FFFFCC"><input name="breadslice[]" readonly="true" type="checkbox" id="breadslice[]" value="Sliced" />
Sliced</td>
</tr>
<?php } while ($row_bread = mysql_fetch_assoc($bread)); ?>
</table>

JAY6390
02-23-2010, 03:07 PM
Try changing

<?php echo $_POST["breadq"+$count]; ?>
to

<?php echo $_POST["breadq"]+$count; ?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum