
June 16th, 2002, 10:53 PM
|
|
|
|
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269
Time spent in forums: < 1 sec
Reputation Power: 2
|
|
|
RE: form validator
The difference is that sometimes you might want to send $submit as the actual string "false", this will evaluate to false in "if ($HTTP_POST_VARS['submit'])" but true in "if (isset($submit))"..
Oh, i purposefully took the "!" out... that makes the functionality between the two statements completely incomparible as they perform two totally different things.
The safest is probably to use :
php Code:
Original
- php Code |
|
|
|
<? if (isset($_POST["submit"])) { } ?>
because this way php won't hit any notices when (in first one) the 'submit' index wasn't created and (in second one) the submit variable (probably) hasn't been defined (before the form is submitted).
When I code without worrying about notices, i'd attach a action=submit somewhere in the form then...
php Code:
Original
- php Code |
|
|
|
<? switch ($action) { case "submit" : submitted(); break; default : notSubmittedYet(); break; } ?>
...
|