Re: Parameter passing question [message #173540 is a reply to message #173537] |
Mon, 18 April 2011 17:42 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma:
|
Senior Member |
|
|
On Mon, 18 Apr 2011 13:03:24 -0400, Chuck Lavin wrote:
> How do I tell these three passed parameters apart (PHP 5)?
> http://www.somewhere.com?param=value // param has been set to 'value'
> http://www.somewhere.com?param= // param has been set to empty (or
> null)
> http://www.somewhere.com // param has not been set at all
This smells like it might be a homework question, or someone doing a
w3schools online certification, but I'll bite.
Have you tried something like the following:
<?php
if (isset($_GET['x'])) {
if ($_GET['x'] == null) {
// it's null
} else {
// it has data
}
} else {
// it's not defined
}
?>
If you have tried it, did it do what you want, and if not how did it fail
to do so[1]?
If you haven't tried it, what have you tried so far?
If you can't figure out what to use for x, please ask your teacher to
revise passing parameters with you again.
Rgds
Denis McMahon
[1] I don't think it quite does what you want, but I also think the
change that needs to be made is trivial and you should be able to deduce
it yourself.
|
|
|