FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Parameter passing question
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Parameter passing question [message #173540 is a reply to message #173537] Mon, 18 April 2011 17:42 Go to previous messageGo to previous message
Denis McMahon is currently offline  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.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: &amp; - form and session problem!
Next Topic: doctype not found?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 05:32:07 GMT 2024

Total time taken to generate the page: 0.04012 seconds