Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Php variable change on link click
Closed Thread
Old 09-26-2006, 05:40 PM   #1 (permalink)
 
Newb Techie

Join Date: Sep 2006

Posts: 14

LordV

Default Php variable change on link click

Hi, im trying to do a script that when i click a link, it changes a variable... All i need is the code that when i click the link, changes the variable, i got everything else covered.


Any help is great, Thanks in advance.
LordV is offline  
Old 09-26-2006, 06:10 PM   #2 (permalink)
 
Contributor

Join Date: Jul 2006

Posts: 84

Ken11235

Default

What do you mean by "changing" the variable?
Ken11235 is offline  
Old 09-26-2006, 06:13 PM   #3 (permalink)
 
Newb Techie

Join Date: Sep 2006

Posts: 14

LordV

Default

Well... Basicly I want a link that makes a variable change

EX.

$var=1;


now when i click a link i want it to change to a set variable such as


$var=5;
LordV is offline  
Old 09-26-2006, 09:46 PM   #4 (permalink)
 
Newb Techie

Join Date: Sep 2005

Posts: 21

Ross

Send a message via AIM to Ross
Default

You can't do this with PHP unless you reload the page onclick because of the fact that PHP is a server side language. You may consider javascript for it.
Ross is offline  
Old 09-27-2006, 09:26 AM   #5 (permalink)
 
Newb Techie

Join Date: Sep 2006

Posts: 14

LordV

Default

Ok thanks
LordV is offline  
Old 09-27-2006, 07:44 PM   #6 (permalink)
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default

What he said is true, but, for example:

$url = 'http://www.test.com/?value='.urlencode($_GET['value']);

Now it'll put that variable after the url (in th above example).

But indeed, PHP is server-side, so you'll have to pass the info along, via $_GET (as above), $_POST (if using forms), cookies, or sessions.

Hmm, hope that halfly helps.
__________________
Vormund is offline  
Old 09-27-2006, 08:16 PM   #7 (permalink)
 
Newb Techie

Join Date: Sep 2006

Posts: 14

LordV

Default

I think i may just have to go and use iframes (dont yell at me, i like them because they are targetable)
LordV is offline  
Old 09-27-2006, 10:57 PM   #8 (permalink)
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default

If you tell me what you're doing, I might be able to help you...

Frames work too. All that nonsense about older browsers not supporting them...Blarg. But yeah, just let me know!
Vormund is offline  
Old 09-28-2006, 11:54 PM   #9 (permalink)
 
Newb Techie

Join Date: Sep 2006

Posts: 14

LordV

Default

Personally i dont like frames... but what i am doing is this:

Http://knightsoftwilight.orgfree.com

This is another site i made with iframes.

Instead of having iframs and targeting it, i wanted to have a div code with the content being <?php include $content; ?> and the links (or buttons) changing the $content to be different files (say home.php, links.php, and news.php)
LordV is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On