How to validate basic html form?
From: deko (nospam_at_hotmail.com)
Date: 07/30/04
- Next message: Frank R. Suchy: "how to run crontab from php skript as a different user"
- Previous message: Tom: "Learning PHP (5) -> cloning objects?"
- Next in thread: steve: "Re: How to validate basic html form?"
- Reply: steve: "Re: How to validate basic html form?"
- Reply: David Mackenzie: "Re: How to validate basic html form?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Jul 2004 22:55:01 GMT
I have a basic Feedback form - I want to prevent blank entries. The problem
with the below code is that the form still Posts if the 'message' field is
blank. The form will not post if the 'email_address' field is blank,
however. Why doesn't it catch empty 'message' field?
<form method="POST" action=
"<?
$message = $_POST['message'];
$email_address = $_POST['email_address'];
if ( empty($message) || empty($email_address) )
{
}
else
{
$email = $_REQUEST['email_address'];
$message = $_REQUEST['message'];
mail( me@mydomain.com, "My Feedback Form", $message, "From:
$email_address" );
}
?>"
name="Feedback" style="font-family: Arial, Helvetica, sans-serif;
font-size:12px">
Email address:
<input name="email_address" type="text" size="30"/><br />
Message:<br />
<textarea name="message" rows="12" cols="25">
</textarea><br />
<input type="submit" value="Send" style="font-family: Arial, Helvetica,
sans-serif">
</form>
Thanks in advance.
- Next message: Frank R. Suchy: "how to run crontab from php skript as a different user"
- Previous message: Tom: "Learning PHP (5) -> cloning objects?"
- Next in thread: steve: "Re: How to validate basic html form?"
- Reply: steve: "Re: How to validate basic html form?"
- Reply: David Mackenzie: "Re: How to validate basic html form?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|