Jump to content

Passing variables from form results page to another.


monkeybidz

Recommended Posts

Heres the deal. My form passes variables to the form_results.php. I have made a link on form_results.php so that users can go to another page. In that next page, i want users to be able to see 2 variables from the form_results.php page.

 

Here are the variables as they appear in pages:

 

Form:

$quote_num

$total

 

From Results:

echo "$quote_num"

echo "$total"

 

New Page:

echo "$quote_num"

echo "$total

 

Can't get the variables in the third page. What am i doing wrong?

Thanks in advance! ???

Easiest thing to do is pass them in the URL to page 3 .. then use $_GET to pull the variables from the URL.

 

You can also store the variables in $_SESSION and pass them on the the next page.

 

From results page:

<a href="http://www.yoursite.com/new_page.php?quote_num=$quote_num&total=$total" />New Page</a>

 

New page:

echo $_GET['quote_num'];
echo $_GET['total'];

 

 

Session Method::

 

From results page:

session_start();
$_SESSION['quote_num'] = $quote_num;
$_SESSION['total'] = $total;

 

New Page:

session_start();
echo $_SESSION['quote_num'];
echo $_SESSION['total'];

Archived

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

×
×
  • Create New...

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.