Jump to content

Recommended Posts

Hello

 

I have a form on html page which posts its results to a PHP page.

PHP page gets the values of form elements and redirects to the right page.

 

So at the end of PHP page I have:

 

if ($v==1)
  $resulturl ='../thanks.htm';
else
  $resulturl ='../incomplete.htm';

$headers = "From: $from ". "\r\n"; 
  header("Location: $resulturl");

 

My question is, how can I pass the variable $v to my page incomplete.htm?

 

Thank you for your help ???

 

EDITED BY akitchin: added code tags. use them in all future posts please.

Link to comment
https://forums.phpfreaks.com/topic/162779-passing-variable-values-between-pages/
Share on other sites

First you should use double quotes for your link variables.

Second, you have to use the GET method and tack on the variable to the end of the URL.  Or you can use a hidden field and pass it along.  Or you can use sessions.  The first option is the easiest.

 

if ($v==1)
  $resulturl ="../thanks.htm";
else
  $resulturl ="../incomplete.htm?v=$v";

$headers = "From: $from ". "\r\n";
  header("Location: $resulturl");

 

Now when you get the incomplete.php you have to use $_GET['v']; to retrieve the value.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.