Re: [PHP] Passing arguments to the same script
what abou using action=questions instead of questions=1, then you can use array: $links=array('questions'=Questions link content will go here, 'samples'=Samples link content will go here, echo $links[$_GET['action']] this would be neater. Troy May wrote: Thanks for responding. I think I'm still doing something wrong. Take a peek: if(isset($_GET['questions'])) { echo Questions link content will go here; } elseif(isset($_GET['samples'])) { echo Samples link content will go here; } elseif(isset($_GET['rates'])) { echo Rates link content will be here; } elseif(isset($_GET['contact'])) { echo Contact information will go here.; } else { echo Main content goes here.; } The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: a href=index.php?samples Any ideas? -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 7:39 PM To: 'Troy May'; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script I'm sure this is easy, but I'm drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: a href=index.php?samples How do I determine what is passed? I need to do an if statement with different outputs depending on the argument. if ($samples) { do something } if(isset($_GET['samples'])) { do something } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing arguments to the same script
Hello, I'm sure this is easy, but I'm drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: a href=index.php?samples How do I determine what is passed? I need to do an if statement with different outputs depending on the argument. if ($samples) { do something } ?? But I can't get anything to work. How do I do it in PHP? (I have no forms, just links) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing arguments to the same script
I'm sure this is easy, but I'm drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: a href=index.php?samples How do I determine what is passed? I need to do an if statement with different outputs depending on the argument. if ($samples) { do something } if(isset($_GET['samples'])) { do something } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing arguments to the same script
Thanks for responding. I think I'm still doing something wrong. Take a peek: if(isset($_GET['questions'])) { echo Questions link content will go here; } elseif(isset($_GET['samples'])) { echo Samples link content will go here; } elseif(isset($_GET['rates'])) { echo Rates link content will be here; } elseif(isset($_GET['contact'])) { echo Contact information will go here.; } else { echo Main content goes here.; } The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: a href=index.php?samples Any ideas? -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 7:39 PM To: 'Troy May'; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script I'm sure this is easy, but I'm drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: a href=index.php?samples How do I determine what is passed? I need to do an if statement with different outputs depending on the argument. if ($samples) { do something } if(isset($_GET['samples'])) { do something } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing arguments to the same script
Thanks for responding. I think I'm still doing something wrong. Take a peek: if(isset($_GET['questions'])) { echo Questions link content will go here; } elseif(isset($_GET['samples'])) { echo Samples link content will go here; } elseif(isset($_GET['rates'])) { echo Rates link content will be here; } elseif(isset($_GET['contact'])) { echo Contact information will go here.; } else { echo Main content goes here.; } The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: a href=index.php?samples This string merely filles the $HTTP_SERVER_VARS[QUERY_STRING] variable. So you should rather check to see if $HTTP_SERVER_VARS[QUERY_STRING] equals 'questions', 'samples', etc... $_GET['var'] requires that the link look like this: a href=index.php?page=samples You could then call $_GET['page'], which would contain the value samples. -- Kyle Gibson admin(at)frozenonline.com http://www.frozenonline.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing arguments to the same script
On Sun, 1 Dec 2002, Troy May wrote: The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: a href=index.php?samples a href=index.php?samples=1 To get the desired results with the code you posted, you have to give your query string parameter(s) a value (as above). If you don't want to give samples a value, then examine the query string as a whole: $_SERVER[QUERY_STRING] if( $_SERVER[QUERY_STRING] == samples ) ... g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing arguments to the same script
What PHP version are you using? Try $HTTP_GET_VARS['sample'] if it's an older version. Also try index.php?sample=1, so that sample actually has a value (although the method I gave you worked on IIS). ---John Holmes... -Original Message- From: Troy May [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 11:02 PM To: [EMAIL PROTECTED]; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script Thanks for responding. I think I'm still doing something wrong. Take a peek: if(isset($_GET['questions'])) { echo Questions link content will go here; } elseif(isset($_GET['samples'])) { echo Samples link content will go here; } elseif(isset($_GET['rates'])) { echo Rates link content will be here; } elseif(isset($_GET['contact'])) { echo Contact information will go here.; } else { echo Main content goes here.; } The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: a href=index.php?samples Any ideas? -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 7:39 PM To: 'Troy May'; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script I'm sure this is easy, but I'm drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: a href=index.php?samples How do I determine what is passed? I need to do an if statement with different outputs depending on the argument. if ($samples) { do something } if(isset($_GET['samples'])) { do something } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing arguments to the same script
I think you\'d want to use: if ( $_SERVER[\'QUERY_STRING\'] == \'samples\') { // code } otherwise if you use , set your links as: a href=\index.php?samples=1\ -js On Sun, 1 Dec 2002 22:38:54 -0500 Holmes wrote: I\'m sure this is easy, but I\'m drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: a href=\index.php?samples\ How do I determine what is passed? I need to do an \if\ statement with different outputs depending on the argument. if ($samples) { do something } if(isset($_GET[\'samples\'])) { do something } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing arguments to the same script
I think you\'d want to use: if ( $_SERVER[\'QUERY_STRING\'] == \'samples\') { // code } otherwise if you use , set your links as: a href=\index.php?samples=1\ -js On Sun, 1 Dec 2002 22:38:54 -0500 Holmes wrote: I\'m sure this is easy, but I\'m drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: a href=\index.php?samples\ How do I determine what is passed? I need to do an \if\ statement with different outputs depending on the argument. if ($samples) { do something } if(isset($_GET[\'samples\'])) { do something } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing arguments to the same script
Not sure which version, it's my ISP. Adding =1 to the URL worked though. Thanks! -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 8:08 PM To: 'Troy May'; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script What PHP version are you using? Try $HTTP_GET_VARS['sample'] if it's an older version. Also try index.php?sample=1, so that sample actually has a value (although the method I gave you worked on IIS). ---John Holmes... -Original Message- From: Troy May [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 11:02 PM To: [EMAIL PROTECTED]; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script Thanks for responding. I think I'm still doing something wrong. Take a peek: if(isset($_GET['questions'])) { echo Questions link content will go here; } elseif(isset($_GET['samples'])) { echo Samples link content will go here; } elseif(isset($_GET['rates'])) { echo Rates link content will be here; } elseif(isset($_GET['contact'])) { echo Contact information will go here.; } else { echo Main content goes here.; } The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: a href=index.php?samples Any ideas? -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 7:39 PM To: 'Troy May'; 'PHP List' Subject: RE: [PHP] Passing arguments to the same script I'm sure this is easy, but I'm drawing a blank. I need to have links at the bottom of the page that passes arguments to the same script (itself) when it gets reloaded. How do we do this? I have the links like this now: a href=index.php?samples How do I determine what is passed? I need to do an if statement with different outputs depending on the argument. if ($samples) { do something } if(isset($_GET['samples'])) { do something } ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing arguments to the same script
Thanks, I got it working by adding =1 -Original Message- From: Chris Wesley [mailto:[EMAIL PROTECTED]] Sent: Sunday, December 01, 2002 8:08 PM To: 'PHP List' Cc: Troy May Subject: RE: [PHP] Passing arguments to the same script On Sun, 1 Dec 2002, Troy May wrote: The only thing that EVER gets displayed is the final else. (Main content goes here.) What am I doing wrong? Once again, the links are in this format: a href=index.php?samples a href=index.php?samples=1 To get the desired results with the code you posted, you have to give your query string parameter(s) a value (as above). If you don't want to give samples a value, then examine the query string as a whole: $_SERVER[QUERY_STRING] if( $_SERVER[QUERY_STRING] == samples ) ... g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php