Jump to content

Simple if statement question


Canman2005

Recommended Posts

Hi all

 

I have a question about if statements, been trying to figure out what the solution could be, but im totally stuck.

 

Okay, I have a simple if statement

 

<?php
if (isset($_GET['user']) != '')
{
print "yes";
}

 

From the above, you will see that if the url is

 

www.domain.com/page.php?user=dave

 

Then it prints "yes", but if the url is

 

www.domain.com/page.php?user=

 

Then it prints nothing.

 

This is fine so far, but if user doesnt exist in the url, for example

 

www.domain.com/page.php

 

then it prints "yes".

 

Surley if ?user doesnt exisit in the URL, then it should print anything.

 

Does that make sense?

 

How can you say

 

if user exists in the url then do the following....

 

Anyone?

 

Thanks in advance

 

Dave

Link to comment
https://forums.phpfreaks.com/topic/42224-simple-if-statement-question/
Share on other sites

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.