Jump to content

simple else statement help


dabempire

Recommended Posts

I know very little about php.  I hoping someone can help with a simple feature.  I want my php page to print one of two things.  Certain incoming links to my site will come in like:

 

www.domain.com/?header1=test1&header2=test2

 

If header1 is not present in the url I want it to print static content.  If there is a header1 variable in the url I want to to print what it says.

 

Header 2 was easy, it's always: <?php echo $_GET["header2"]; ?>

 

For header 1 I have the following, but I don't know how to complete it.

 

<h1>
<?php
if ($header1 == null) {
    echo "We're Here to Help";
} else {
    WHAT_GOES_HERE
}
?>
</h1>

 

 

First question:  Do I use "null" or is there something better to see if there's even a header1 at all?

 

Second question:  How do I finsh the else part to print whatever header1 is in the variable?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.