Jump to content

Archived

This topic is now archived and is closed to further replies.

aceishigh

Simple PHP help needed!

Recommended Posts

Hey,

I have a real simple problem, I have a 3 page process which puts data into 3 seperate MySQL tables and I create an ID on the first and wish to just pass this over to the second page. How do you pass over data from one page to the next?

Share this post


Link to post
Share on other sites
do a hidden input in your form with the value you want to pass. or start a session and pass your variable through a session.

Share this post


Link to post
Share on other sites
[!--quoteo(post=375787:date=May 21 2006, 10:47 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 21 2006, 10:47 AM) [snapback]375787[/snapback][/div][div class=\'quotemain\'][!--quotec--]
do a hidden input in your form with the value you want to pass. or start a session and pass your variable through a session.
[/quote]

Hey thanks for the quick reply, maybe I should have been a little more specific :S ok, I don't think I can add a hidden input field because I am using a php generated random number and storing this as a business ID in one table. On the second page I want to add this businessID to a seperate table so they can be linked. So I wanted to post my $businessID field to the next page so this can be inserted into the table. So can you post businessID from page 1 to page2? I'm really stumped, I have thought long and hard about this think logically this is the best way of doing what I need.

Share this post


Link to post
Share on other sites
[!--quoteo(post=375804:date=May 21 2006, 11:09 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 21 2006, 11:09 AM) [snapback]375804[/snapback][/div][div class=\'quotemain\'][!--quotec--]
how are you moving from page 1 to page 2?
[/quote]


Hi, I'm having the same problem. Here's what I'm doing: First Page includes data using a form. When I click submit I need to pass the ?id= variable in order to get the second form on the second page working with the id.


$insertGoTo = "Players_Include.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

Thanks

Share this post


Link to post
Share on other sites
Structure like this

::page1.php::

[code]<FORM action='page2.php'>

     <fields for form 1>

</FORM>[/code]


::page2.php::

[code]<?php
    process form 1 data
    insert record
    get $newid
    ?>

   <FORM action='page3.php'>

     <hidden field name='newid' value='$newid>
     <fields for form 2>

    </FORM>[/code]

etc

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.