Jump to content

[SOLVED] url variable _GET


johnwayne77

Recommended Posts

I have this url:

 

http://www.imobconsulting.ro/tv/main.php?program=ngc

 

where the value of program changes (for ex.: ngc, ers, prm, mtv )

 

good...

 

now I want to display the title for each page according to the program= option selected.

 

For example if the url is:

 

http://www.imobconsulting.ro/tv/main.php?program=ngc

 

I want the title to be National Geographic

 

or if it is http://www.imobconsulting.ro/tv/main.php?program=mtv

 

then I would want Music Television

 

how do I do that?

 

I believe I have to define some variables somewhere and use the IF statement?

 

Help would be greatly appreciated.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/36810-solved-url-variable-_get/
Share on other sites

use $_REQUEST['variable'] to pull the variable from the url.  you then can run an if statement and set the title of the page according to the variable that was passed to the url.

 

$var = $_REQUEST['program']

 

if($var == 'blah')

{

  echo "blah";

} else if($var == '....')

  echo "....";

} else if.....so on

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.