note 39190 added to control-structures
| From: | admin at tenriats dot com | Date: | Tue, 20 Jan 2004 09:59:24 +0000 |
| Subject: | note 39190 added to control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-63862@lists.php.net to get a copy of this message | ||
Yeah, it's also great to use if statements when you're using the POST method in a form and
you have required fields. Here's an example.
<form action=login.php method=POST>Email: <input type=text
name=email><br>Password: <input type=password name=pass><br><br><input
type=submit value=Login!>
Now we make sure our required fields have been filled.
<?php session_start();
if (!$email) { print "You didn't enter your email into the form! Please go back and do
so."; exit; } elseif (!$pass) { print "You didn't enter a password! Please go back
and do so."; } else { session_register($email); session_register($pass); } ?>
----
Manual Page -- http://www.php.net/manual/en/control-structures.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39190
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39190&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39190&report=yes
Search -- http://master.php.net/manage/user-notes.php