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

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    A couple times I have tried to take the data from a form and, once I have written it to a database, put it into a new form for transmission to another location with other form fields for additional data, but I have yet to figure out how I can pass the variable gotten from the first form to the new form, other than re-opening the database and taking it out of there. There must be a more efficient way of passing a variable. the most recent application is one in which form data is submitted, witten to a database and then the amount entered is sent, via new submit button to a secure server. Any ideas?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    15
    Well one approach would be to have the page that inserts the data and the new form be the same. So one form posts to a page which contains some php code at the top that inserts into the database and then displays the new form below it with access to all the variables which were just inserted
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    I'm fairly new to php, but what I did was create a variable holding the query:

    --------------------------------------------
    <?
    // let us build a query string:

    $qs = "?ip1=" . urlencode ($ip1) .
    "&ip2=" . urlencode ($ip2) .
    "&ip3=" . urlencode ($ip3) .
    "&ip4=" . urlencode ($ip4) .
    "&relDomainID=" . urlencode ($relDomainID) .
    "&relSystemID=" . urlencode ($relSystemID)
    ;

    $URL = "YOURFORM.PHP" . $qs;
    ?>

    <form method=post ACTION="<? echo ($URL) ?>

    -------------------------------------------

    So you can submit to "yourform.php" with the query behind the URL.

    But I always use 1 page for listing, validating and inserting. Works fine with me.


    ------------------
    ---------------------
    Hans Buis
    Framers
    http://www.framers.nl
  6. #4
  7. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    This is all nice, but let me tell you, from a recent experience..

    I just finished up a "registration" form, that worked in steps..

    you know.. fill in information, submit, get presented the next set of input fields..

    This presented some very interesting situations..

    Granted, I did it all in one document, like I normally handle forms with PHP.. but I found myself faced with a some very interesting issues..

    All -in-all I opted to insert the data into the database at the end of each step.

    That way I didn't have to carry copius amounts of hidden form fields.

    I also chose to use a cookie in conjunction with a hidden field.. to solve any "non-cookie" users.

    So far it appears to work nicely.. my problem really came from trying to decide "where" to start the database entry process.

    If anyone knows of a way to prevent a document from being stored in a viewers browser history.. I would certainly like to know.. that would solve other potential problems

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  8. #5
  9. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by hansel:
    I'm fairly new to php, but what I did was create a variable holding the query:

    [/quote]


    Just FYI, if you're running Apache, there is a global variable $QUERY_STRING that already holds the query....it might work on other servers, also, you'd have to give it a try...
    http://www.php.net/manual/html/langu...redefined.html

    ---John Holmes..


    ------------------
    *************************************************************
    * The manual can probably answer 90% of your questions...
    *
    * PHP Manual. www.php.net/manual
    * MySQL Manual: www.mysql.com/documentation/mysql/bychapter
    *************************************************************
  10. #6
  11. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    or the old fashioned way...

    <input type="hidden" name="passed_var" value=<? echo $passed_var;?>">

    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL

Similar Threads

  1. passing javascript to a php generated form
    By jhedstrom in forum JavaScript Development
    Replies: 8
    Last Post: August 25th, 2005, 09:08 PM
  2. Replies: 3
    Last Post: March 5th, 2004, 08:08 AM
  3. HTTP Error 400: Bad Request, with basic form
    By crackwombat in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 06:40 PM
  4. Send a varible to another script without a form or url
    By xaviergenone in forum PHP Development
    Replies: 9
    Last Post: December 31st, 2003, 07:10 PM
  5. form variables not passing (and using $x = $_POST['x']...)
    By alvaromg in forum PHP Development
    Replies: 10
    Last Post: December 1st, 2003, 11:35 AM

IMN logo majestic logo threadwatch logo seochat tools logo