Helpful Information
 
 
Category: Programming Languages
help with ordering form

Hi,

Im making a ordering form, first step its to select how many products you want to order, lets say 2, well then php starts working, the next page returns 2 textfields to insert the products, then for last, the confirmation page showing all the detail of the products then you click accept to send via mail the order form, heres the problem:

I cant display all the products details in the confirmation page becose in the html of the ordering page loads depending on how many products you selected to order lets say 2, the textfields in the table looks like this

<td><input type.... name=id1</td>
<td><input type.... name=id2</td>

why the 1 and 2 after id?? couse if I only define the product field as "id" all the textfields in the order form apear like:

<td><input type.... name=id</td>
<td><input type.... name=id</td>

so I attached the $i value that its the one that incrementes in the order page so it gives a uniqe value to every id field.

In the order confirmation (next page) Ive set

"select * from productos where id='$id'"

But doesent work couse any field is called id, avery id field has an increment number.

How can I set the las character of ID in
"select * from productos where id='$id'"
increment one by one of a wildcar so it detects or consults all the before fields? id1, id2.
So it maches the fields from the order form?

Order script

<?
$i = 1;
while ($i <= $campos):
echo ("
<tr>
<td>$i.-</td>
<td><input type="text" name=id$i></td>
<td><input type="text" name=cantidad$i></td>
</tr>
");
$i++;
endwhile;
?>


Confirmation script

mysql_connect('localhost','root','' );

$result = mysql_db_query(orden,"select * from productos where id='$id1' ");
while ($row=mysql_fetch_object($result) )
{
$tot = $row->precio * $cantidad * 1.15;
echo ("
<tr>
<td>$row->id</td>
<td>$row->nombre</td>
<td>$row->precio</td>
<td>$cantidad$i</td>
<td>$tot</td>
</tr>
");}
mysql_free_result($result);
?>

Thanx allot
ICQ 4287383

[This message has been edited by ltena (edited February 21, 2000).]

Luis,
I've sent the solution (i think) to your email @gmx.de http://www.devshed.com/Talk/Forums/smile.gif

Copperfield http://www.devshed.com/Talk/Forums/smile.gif










privacy (GDPR)