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 Quote Link to comment 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 } ?> Quote Link to comment 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'; ?> Quote Link to comment Share on other sites More sharing options...
jeffphp Posted February 8, 2008 Author Share Posted February 8, 2008 Thanks guys for the fast response. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.