RE: [PHP] not getting form variables using POST.
| From: | burk at pobox dot com | Date: | Fri, 27 Oct 2000 14:39:29 +0000 |
| Subject: | RE: [PHP] not getting form variables using POST. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22337@lists.php.net to get a copy of this message | ||
On Fri, 27 Oct 2000, Deepak Chawla wrote:
If you're in a function, declare $passwd and $uname global.
Also the comparison operator in php is "==" or "===".
Your code as written below could be read as
"if I successfully assign "123456" to uname and I successfully assign
"654321" to passwd, give access."
Take home message: if you always write equality tests with the string
first, ("123456" == $uname) the interpreter will catch the "=" vs "=="
mistake. Very handy for people who also work in Visual Basic or Delphi.
Hope this helps
-burk
> yes.
> I'm using it as below
>
> ------------ part of html file ------------------
> <form action="Login.php" method="post">
> <input type="text" name="uname" size=10>
> <input type="hidden" name="passwd" size=10>
> <input type="submit">
> </form>
>
> ---------- part of php script --------
> if($uname="123456" && $passwd="654321")
> give_access();
> else error_msg("Sorry");
> ---------------------------------------
>
--
burk@pobox.com
Linux File Managers: http://www.pobox.com/~burk/linuxfile.html