Posting a non form variable?

Ok this may sound a bit confusing but I want to post a variable that is not part of a form thing ie a button or textbox. I want to post a variable ie say $firstTime

Basically I got $firstTime set to 0 and when the guy clicks the submit button I want to send this variable to another page. Is there a way to do this?

In the page it gets sent to I want to be able to do something like:
if ($firstTime=0)
this stuff

else
this stuff

yes, it is a bit confusing : )

i’d like to know why u want to to it.

  1. use hidden fields (<input type=“hidden” name=“thename” value=“thevalue”)
  2. use sessions (session_register(); $_SESSION[‘thename’]=‘thevalue’)
  3. use normal cookies
  4. use a database to store a person (maybe just ip, or more to make sure u don’t have to diffrent persons using the same gateway)

but that depends on why u wanna have a variable submitted that is not part of the form. security? ergonomy?

Q

Thx I used number 1.

You’ll always have to use a form if you want to carry form elements to the next page. There are ways around this but they’re complex and not really worth anyone’s time.

Sponsor our Newsletter | Privacy Policy | Terms of Service