Page 1 of 1

Text Link with Value...

Posted: Sun Mar 26, 2006 7:13 am
by Qaid
Hi,

I know its possible to set a value in a form a an input.
However is it also possible to set a value in a normal text link?

Form:

Code: Select all

<form method="post" action="url.php">
<input value="THIS_IS_A_VALUE" name="NAME_HERE" type="HIDDEN">
</form>
Text Link:

Code: Select all

<a  href="URL">Text</a>
The value won't work in the Text Link?

Any ideas?

Thanks everyone...

Posted: Sun Mar 26, 2006 7:26 am
by jmut
what are you trying ot achive?
Why would you need this.

Posted: Sun Mar 26, 2006 7:31 am
by Qaid
On a different page i have a php page where i people can change the weather. So on that page i have this code "$weather".

If i use the form i can make the value to either day, night or another one. Then it will change.

Hope you understand...

Posted: Sun Mar 26, 2006 7:57 am
by AYYASH
I hope I understand. You need to submit the from values by adding <input type="submit" /> in order to move the values to the other page.

Posted: Sun Mar 26, 2006 8:18 am
by Qaid
Yes this is with the form code..

But it is possible with the text link?

Posted: Sun Mar 26, 2006 8:58 am
by leyen
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


it's possible on a text link, but ur user will still have to reload the page (not an instant javascript thing) and there's much more coding involved.

for example, if ur script was weather.php, create the link

Code: Select all

<a href="weather.php?display=rainy">Rainy Weather</a>
And then, on weather.php,

Code: Select all

//Check for Weather Display
if ( isset($HTTP_GET_VARS['display']) || isset($HTTP_POST_VARS['display']) ) { $display = ( isset($HTTP_POST_VARS['display']) ) ? $HTTP_POST_VARS['display'] : $HTTP_GET_VARS['display']; }
else { $display = ''; }

if ( empty($display) ) {

//the page you display when weather has not been selected

} else if ( $display == 'rainy' ) {

//display a rainy weather page

} else if ( $display == 'sunny') {

//display sunny

} ETC
hope you get the hang of it... of course, these codes are only snippets of the entire script, u do need ur opening "<? php" and ending etc..


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]