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_ad dress) )
{
}
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_add ress" 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.
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_ad dress) )
{
}
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_add ress" 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.
Comment