Current location: Hot Scripts Forums » Programming Languages » PHP » lost variable in second link


lost variable in second link

Reply
  #1 (permalink)  
Old 03-14-09, 12:34 AM
Textahead Textahead is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
lost variable in second link

I have 2 menus each with many links. State and Direct.
I have the links setup as follows. first menu

<a href=meet.php?state=texas>Texas</a>
<a href=meet.php?state=california>California</a>
ect;

second menu
<a href=meet.php?direct=health services>health services</a>
<a href=meet.php?direct=motels>Motels</a>
<a href=meet.php?direct=parks>Parks</a>
ect;

Visitors will first pick a state which takes them to a new page with the state displayed at the top then they clcik an item from the direct menu and I need the next page to display both the state and the directory choice


SWITCH ($_GET["state"])
case 'texas':
echo ("Texas") ;
break;
blah blah


SWITCH ($_GET["direct"])
case 'health services:
echo ("Texas") ;
break;


I can get one or the other to display but not both. when clicking a link in the ($get[direct]) it seems to reset the first variable
Any ideas on how I can display a record on what state AND direct links have been followed?


Part 2

I also need to get apropriate info from the database acording to what links have been clicked on so I need the variables to stay constant

Last edited by Textahead; 03-14-09 at 12:40 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 03-14-09, 10:46 PM
zamight zamight is offline
New Member
 
Join Date: Mar 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
For the second menu you are missing the state variable.
<a href=meet.php?direct=health services>
Should be:
<a href=meet.php?state=$_GET['state']&direct=health services> (Example, not valid with code)

For the second menu the State variable isn't passed through the second link. You will need to pass the state with the direct also so they are both passed through the $_GET.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 03-15-09, 12:33 AM
Textahead Textahead is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Hmmm almost there. both links are now showing but the one from the first menu is only showing the default once ive moved onto the second menu
In my first menu the default is "LOST" and once i click the second menu i get this displayed

" lost Churches"
which should read
"California Churches"

Could it be a problem with

<a href="meet.php?city=$_GET['city'] & page=RR"> Churches</a><br>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to set a variable to a link? tanermacit PHP 2 11-06-08 11:59 AM
Six Sites Exchanging Links! - PR3+ Web Hosting, Web Design, Entertainment & Career coffeecoder General Advertisements 0 10-10-05 01:52 AM
Xml / Dom / Css Mark_SC.SE JavaScript 0 06-29-05 09:05 AM
I'm confused..plz help Brittany23 CSS 5 05-24-05 12:52 PM
Passing a table or variable through a link? chinablack1480 PHP 1 12-07-03 04:55 AM


All times are GMT -5. The time now is 06:39 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.