Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Carrying variable in URL through different pages

Status
Not open for further replies.

sbayter

IS-IT--Management
Nov 14, 2002
95
CO
Hi,
I am migrating from ASP to PHP and I have a survey I need to convert.
It works like an application in which each question in in different pages.
I need the variable that carries the name of the person filling out the survey to to be on each page of the survey.
I want to carry it in the URL (ie. survey.php?name=Bob)
Is there any way to sent it from the "action" of the form?
Thanks in advance, sbayter
 
Sure.

<form method=POST action=&quot;survey.php?name=Bob&quot;>
.
.
.
</form>

Will work, and will allow you to send form data to PHP by both GET (the fields in the URL) and POST (the fields on the form).

You might also look at session variables. Want the best answers? Ask the best questions: TANSTAAFL!
 
You can also send it in the URL by using a hidden element in the form.

<Input type=&quot;hidden&quot; name=&quot;user&quot; value=&quot;bob&quot;></Input>

The variable $user will have the value &quot;bob&quot; in the target page, and the input element will be invisible to the users. You could also pass it in the URL without a form by making it an attribute of a link.
 
//<form method=POST action=&quot;survey.php?name=Bob&quot;>

I tried this with no success.
In the url of the next page if showed:
...survey.php?name=
but no value was in it.
Thanks,
sbayter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top