Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-24-2004, 02:24 AM   #1
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
PHP Question = Keeping a Variable

Quick question, I am trying to make it so that a variable is kept even when the user clicks to another page. For example:

They go to www.yahoo.com?ref=55

and then from yahoo they click news. I want it to then go to:

www.yahoo.com/news?ref55

instead of just going to

www.yahoo.com/news



Hope someone can offer a script for this or an alternative easy to use method.
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 02:39 AM   #2
xxxoutsourcing
Confirmed User
 
Join Date: Oct 2003
Posts: 3,888
PHP Code:
<?php echo  $id[0]; echo $1d[1];?>
you need something like this, the more ID's you add the more code you can carry on your ?id=123456
the above code is good for only two
__________________

xxxoutsourcing.com
ICQ:119936 | Aim:xxxoutsourcing | MSN:msn@ xxxoutsourcing.com | Yahoo:xxxoutsourcing
Submitters, Designers, Programmers, Cartoonist, Creative Writers, Video & Photo Editors
Convert your Paysite into a cartoon site convert2toons.com
xxxoutsourcing is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 02:47 AM   #3
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Thanks, but I don't think this solves the problem on keeping the variable stored so I can use it on the next page. I am testing out some cookie functions now, I think that is what I needed.
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 02:47 AM   #4
SilverTab
Confirmed User
 
Join Date: Nov 2001
Location: MTL
Posts: 5,060
Quote:
Originally posted by raulph
Quick question, I am trying to make it so that a variable is kept even when the user clicks to another page. For example:

They go to www.yahoo.com?ref=55

and then from yahoo they click news. I want it to then go to:

www.yahoo.com/news?ref55

instead of just going to

www.yahoo.com/news


Hope someone can offer a script for this or an alternative easy to use method.
well let's say you go to
www.url.com/index.php?id=1234

you can print the variable in your page by using <?=$id?>
so just print it in your link...
(let's say you want news.php to carry the variable you would use
PHP Code:
<a href="news.php?id=<?=id?>">
or you can store it in a session variable if you want to carry it around on multiple pages etc etc.....lots of ways to do it..
__________________
mmm my sig was too big... no more cool animation
but hey still! need php? ICQ: 94586959

Last edited by SilverTab; 11-24-2004 at 02:49 AM..
SilverTab is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 02:49 AM   #5
SilverTab
Confirmed User
 
Join Date: Nov 2001
Location: MTL
Posts: 5,060
Quote:
Originally posted by raulph
Thanks, but I don't think this solves the problem on keeping the variable stored so I can use it on the next page. I am testing out some cookie functions now, I think that is what I needed.
in this case, what you want is a session variable...
__________________
mmm my sig was too big... no more cool animation
but hey still! need php? ICQ: 94586959
SilverTab is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 02:53 AM   #6
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
PHP Code:
<a href=http://www.nextlinkontthepage.com?ref=<? echo $ref; ?>>link</a>
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 02:55 AM   #7
V_RocKs
Damn Right I Kiss Ass!
 
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,409
after you drop the cookie,
PHP Code:
<?=$_REQUEST['ref']; ?>
So php checks the cookie, post and get requests for the info.
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 03:00 AM   #8
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
PHP Code:
<a href="news.php?id=<?=id?>">
This seems like the easiest method for what I am doing. Thank you guys so much, nice to get instant php support at 5am ;)
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 03:07 AM   #9
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
[QUOTE]Originally posted by raulph
[B]
PHP Code:
<a href="news.php?id=<?=id?>">
Got it working but you forgot the $ in <?$id?>">

Thanks again guys!
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 05:29 AM   #10
BastarD
Confirmed User
 
Join Date: Apr 2004
Location: Very close to that Jack Daniels bottle..
Posts: 6,341
Try using smarty (smarty.php.net), they have something like $smarty -> assign;
BastarD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-24-2004, 05:32 AM   #11
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally posted by raulph
PHP Code:
<a href="news.php?id=<?=id?>">
This seems like the easiest method for what I am doing. Thank you guys so much, nice to get instant php support at 5am ;)
asking a php question... and only needing to know how to do that..

that's like stepping into a fomula 1 car and asking how to step on the gas.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.