jeffphp Posted February 8, 2008 Share Posted February 8, 2008 for a ppc campaign I'm running, to improve my quality score I'm pulling my adwords keyword from the URL. site.com/index.php?kw=my keyword in the page I pull the kw using <?echo $_GET['kw'] ?> Now the page will look bad if someone clicks around, comes back via a normal link and sees an empty space How can I make this so <?echo $_GET['kw'] ?> IF kw exists, or if kw doesn't exist, default to "something I choose" Thanks! Jeff Link to comment https://forums.phpfreaks.com/topic/89989-solved-need-help-if-then-with-getting-a-url-param/ Share on other sites More sharing options...
pocobueno1388 Posted February 8, 2008 Share Posted February 8, 2008 <?php if (isset($_GET['kw'])){ //keyword DOES exist, show whatever. } else { //DOES NOT exist, show default } ?> Link to comment https://forums.phpfreaks.com/topic/89989-solved-need-help-if-then-with-getting-a-url-param/#findComment-461373 Share on other sites More sharing options...
JacobYaYa Posted February 8, 2008 Share Posted February 8, 2008 If you are just wanting to set the variable, you can do this <?php $kw = (isset($_GET['kw'])) ? $_GET['kw'] : 'something you choose'; ?> Link to comment https://forums.phpfreaks.com/topic/89989-solved-need-help-if-then-with-getting-a-url-param/#findComment-461375 Share on other sites More sharing options...
jeffphp Posted February 8, 2008 Author Share Posted February 8, 2008 Thanks guys for the fast response. Link to comment https://forums.phpfreaks.com/topic/89989-solved-need-help-if-then-with-getting-a-url-param/#findComment-461386 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.