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

    Join Date
    Feb 2000
    Rep Power
    Is there an easy way to pass varibles from one page to the next?
    1. I have a form (index.shtml) where you enter data

    2. Then when the preview button is clicked it runs a script (order.php3)that queries the database for more details and displays both the form data and data from the database.

    3. When you click the confirm button it runs a script (order_confirm.php3) which grabs certain varibles and email/posts to database.

    The problem I'm having is getting a hold of these varibles that reside in the order.php3 script and properly referring to them in my order_confirm.php3

    Any ideas would be appreciated
    Tom K
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Den Laeghe Landen
    Rep Power
    In your order.php3, i figure you have a form.
    (because of the submit-button)
    well, let's say you have some variables in order.php3, you want to use in order_confirm.php3. What you do, is write the names and values of these vars in the form, by using 'hidden fields':
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>

    echo "<FORM METHOD=POST ACTION=order_confirm.php3>n";
    echo "<INPUT TYPE=hidden NAME="name" VALUE="$name">n";
    echo "<INPUT TYPE=hidden NAME="foo_array[]" VALUE="$foo_array[0]">n";
    echo "<INPUT TYPE=hidden NAME="foo_array[]" VALUE="$foo_array[1]">n";
    echo "<INPUT TYPE=hidden NAME="foo_array[]" VALUE="$foo_array[2]">n";
    * and here some mroe form-tags *
    echo "</FORM>n"
    Of course, you'd better write a small function that walks through an array and for each element, prints a hidden form-field (instead of these 0, 1, and 2 up here), but i think you can figure that iout yourself.

    Hope, this helps you.


    <WARNING: signature has NULL-value>

Similar Threads

  1. Passing POST variables
    By rlorenzo in forum PHP Development
    Replies: 11
    Last Post: June 6th, 2004, 02:00 PM
  2. Replies: 7
    Last Post: February 16th, 2004, 02:55 PM
  3. help with assigning variables, variable passing/ retrieval
    By pinkipodmini in forum PHP Development
    Replies: 0
    Last Post: February 13th, 2004, 09:40 PM
  4. Why variables aren't passing through the include()
    By sapien in forum PHP Development
    Replies: 7
    Last Post: November 12th, 2003, 09:35 PM
  5. Help passing variables from a text file via include()
    By c4ctuz in forum PHP Development
    Replies: 4
    Last Post: October 14th, 2003, 08:00 AM

IMN logo majestic logo threadwatch logo seochat tools logo