Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #17465
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: If an arg is not there... |
| Date | 2017-06-02 22:45 +0200 |
| Message-ID | <epe13jFbr6iU1@mid.individual.net> (permalink) |
| References | <ed12fab8-a423-43c4-a004-9ccc8ccafb5b@googlegroups.com> |
On 06/02/17 21:58, bit-naughty@hotmail.com wrote: > If I pass an arg to a PHP prog, how do I read it? Like site.com/prog.php?arg=cool - how do I read arg and get the word "cool" in my program? $_GET[] if you just expect requests which has the value in the URL as in your example. $_REQUEST[] if you expect both POST (<form><input type='text'...><input type='submit'...></form>) and GET (as in your example). > And - if an arg is not there, like, say above, the argument "arg2" is not there, only "arg" - whatever method is used for reading args (eg. $_REQUEST something or whatever), that will be blank for arg2, right? (eg. $_REQUEST["arg2"] etc.) If arg2 is sent but with an empty value, then the $_GET['arg2'] will be empty, if arg2 is completely missing from the request, then there ain't a $_GET['arg2'] Please read at least these pages: http://php.net/manual/en/reserved.variables.get.php http://php.net/manual/en/reserved.variables.post.php http://php.net/manual/en/reserved.variables.request.php http://php.net/manual/en/function.isset.php http://php.net/manual/en/function.empty.php There you will find the answers you look for. -- //Aho
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
If an arg is not there... bit-naughty@hotmail.com - 2017-06-02 12:58 -0700 Re: If an arg is not there... "J.O. Aho" <user@example.net> - 2017-06-02 22:45 +0200
csiph-web