#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Mexico DF Mexico
    Posts
    16
    Rep Power
    0
    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).]
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    79
    Rep Power
    15
    Luis,
    I've sent the solution (i think) to your email @gmx.de

    Copperfield

Similar Threads

  1. Avoid form resubmission when REFRESH clicked
    By rahulgup in forum ASP Programming
    Replies: 0
    Last Post: February 5th, 2004, 01:21 PM
  2. HTTP Error 400: Bad Request, with basic form
    By crackwombat in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 06:40 PM
  3. sending form field data
    By bellcom in forum PHP Development
    Replies: 1
    Last Post: January 19th, 2004, 03:39 PM
  4. form creation using php
    By emzyme in forum PHP Development
    Replies: 4
    Last Post: January 15th, 2004, 06:23 AM
  5. access 2000 - problem with making a form a pop-up
    By ironchef in forum Database Management
    Replies: 0
    Last Post: December 15th, 2003, 10:48 AM

IMN logo majestic logo threadwatch logo seochat tools logo