Hi guys,
I pass, with the URL, a variable through to a page in my site.
Let's call the variable 'index'.
In that page a submit happens when you press a button.
And then, when you press that button, I want to use that variable, but at that point the variable is 0.
How can I store this variable somewhere so that when I press the submit button, it still knows the value of the variable ?
remembering a passed through variable
Moderators: egami, macek, gesf
Store it as a cookie or session value, or if you've got a form that you're using, store it as a hidden field in that form!
-
- New php-forum User
- Posts: 9
- Joined: Sun Jun 30, 2002 6:45 am
Like this ?
<input name="forumIndex" type="hidden" value="$fIndex">
Cause when I type this:
echo "$forumIndex";
It gives me the following result: $fIndex which is wrong
<input name="forumIndex" type="hidden" value="$fIndex">
Cause when I type this:
echo "$forumIndex";
It gives me the following result: $fIndex which is wrong
-Bl@derunner-
-
- New php-forum User
- Posts: 9
- Joined: Sun Jun 30, 2002 6:45 am
its ok, i got it :-)
i did it with : value="<?php echo "$fIndex"; ?>"
i did it with : value="<?php echo "$fIndex"; ?>"
-Bl@derunner-
-[Bl@de Runner]- wrote:its ok, i got it :-)
i did it with : value="<?php echo "$fIndex"; ?>"
You could just do value="<?=$fIndex?>"
- WiZARD
- Moderator
- Posts: 1240
- Joined: Thu Jun 20, 2002 10:14 pm
- Location: Ukraine, Crimea, Simferopol
- Contact:
Jay wrote:[quote="-[Bl@de Runner]-"]its ok, i got it :-)
i did it with : value="<?php echo "$fIndex"; ?>"
You could just do value="<?=$fIndex?>"[/quote]
Hi interesting whats is mean "=" in your script, - never use this....
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";


WiZARD wrote:Hi interesting whats is mean "=" in your script, - never use this....
It's take from ASP I believe. It just means to output quickly, an alternative to echo or write! Very good for writing small scripts, and you can even use it with functions, eg:
value="<?=$url.$page.urlencode($someVariable)?>"
Or even:
value="<?=($value)? "Yes":"No"?>"
You just use it for single line scripts!