passing php variables
- Started
- Last post
- 14 Responses
- ********
I've done the Google thing..., and my books aren't helping.
How do I send a PHP variable to another page without submitting it as a form? Basically I want to send something like a hidden field to the next page by a user hitting a text link, not a button.
It's doing me crust in, man. Help a hippie out...
- unfittoprint0
You'll probably have to use sessions. I don't see other options...
- enobrev0
well, one page to the next through a link is generally through the link itself:
nextpage.php?var1=value1
If you want to hide the variable from the user you'll want to look into sessions as previously mentioned or cookies.
Also, you could hold a value in a db and just have a session_id or user_id held in the url params (above) or session / cookie. Then on the next page, call up the record of the user's session.
- unknown0
can't you stick it in the url? like www.hola.es/nextpage.php?variabl…...
i.e you link would be constructed?
- ********0
I guess I can stick it in the url...!
I've only recently started to code the stuff and wasn't aware you could do this. Oddly - all the examples in my book were form based... In fact, the book has proved fucking useless...
- Kernit0
did you mean 'parsing' php variables? i'm not a programmer, but that might be a reason why google came up with nowt.
- ********0
no I meant passing, as in sending from page to the next. Is that the same thing? I didn't think it was....
See my understanding is limited... but everything I've tried works so far ;)
- Kernit0
oh, no it's not the same thing. don't mind me! just a thought.
- ********0
ok kermit!
thanks enobrev. That worked first time.... cooking with gas now....
- ********0
Hmm. What's the delimiter should I wish to pass multiple variables?
- enobrev0
nextpage.php?var1=value1&var2=va...
- ********0
Cool.
After many ',' '"', '$' i figured it out.
- Kernit0
kerNit dude, kerNit...
- ********0
...sorry kermit, i was jesting.
- mitsu0
"...sorry kermit, i was jesting."
hehe