Text Link with Value...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Qaid
Forum Commoner
Posts: 33
Joined: Wed Feb 15, 2006 12:04 pm

Text Link with Value...

Post 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...
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

what are you trying ot achive?
Why would you need this.
Qaid
Forum Commoner
Posts: 33
Joined: Wed Feb 15, 2006 12:04 pm

Post 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...
AYYASH
Forum Newbie
Posts: 16
Joined: Sat Aug 14, 2004 2:33 am

Post 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.
Qaid
Forum Commoner
Posts: 33
Joined: Wed Feb 15, 2006 12:04 pm

Post by Qaid »

Yes this is with the form code..

But it is possible with the text link?
leyen
Forum Newbie
Posts: 5
Joined: Sat Mar 25, 2006 4:45 am

Post 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]
Post Reply