i understand that most email forms don’t work right and i am new to this coding and need to be to send all of this form in an email including the comments text area. what is missing from this form script to be able to do what i need it to do? also the input tags are missing required attributes and comes up as a error on the browser check using dreamweaver 2004 mx
<form action=”mailto:
<table border=”0″ cellpadding=”8″ cellspacing=”8″ summary=”feedback form”>
<tr><td><label for=”name”>Name</label>:</td><td><input type=”text” name=”name” id=”name” size=”25″ /></td></tr>
<tr><td><label for=”email”>Email address</label>:</td><td><input type=”text” id=”email” name=”email” size=”25″ /></td></tr>
<tr>
<td colspan=”2″>
<label for=”comments”>Comments</label><br />
<textarea rows=”15″ cols=”45″ name=”comments” id=”comments” ></textarea>
</td>
</tr>
<tr>
<td align=”center” colspan=”2″>
<input type=”submit” value=”Send Feedback” /><input type=”reset” />
<br /></td>
</tr>
</table>
</form>
it goes to the default email page and wants to compose an email with the right email address to send to but none of the comments are included. i need all of the comments with the form in an email to be directed to the email address provided above.
<form name="comments" action="http://www.stpeteavionics.com/mailer.php" method="post">
<p>
<input type="hidden" name="form_email" value="[email protected]">
<input type="hidden" name="form_thankyou" value="http://www.stpeteavionics.com/THANKYOUPAGE.HTML">
</p>
<table width="455" height="327" border="0">
<tr>
<td width="180" height="43" class="style12"><label>Your Name</label>
: </td>
<td width="265"><input name="yourname" type="text" size="30" maxlength="50"></td>
</tr>
<tr>
<td height="29"><label>Email</label>
Address:</td>
<td><input name="email" type="text" size="30" maxlength="50"></td>
</tr>
<tr>
<td height="32">Comments</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><textarea name="comments" cols="40" rows="10"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
</form>
[code=php]<?php
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email = $HTTP_POST_VARS['email'];
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];
/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*/", $email)) {
echo "Sorry you did not add a correct e-mail. <br>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "Sorry you did not add a subject. <br>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail("[email protected]",$subject,$message,"From: $email")) {
echo "Thank you for sending your feedback.";
} else {
echo "Sorry $email we can not send form.";
}
?>[/code]
[code=html]<form action="mail.php" method="POST">
<p>Your e-mail:<br>
<input type="text" name="email" size="40"></p>
<p>Subject:<br>
<input type="text" name="subject" size="40"></p>
<p>Message:<br>
<textarea cols="40" rows="10" name="message"></textarea></p>
<p align="center"><input type="submit" value="Send"></p>
</form>[/code]
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$name = $HTTP_POST_VARS['name'];
$email = $HTTP_POST_VARS['email'];
$comments = $HTTP_POST_VARS['comments'];
/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */
if (!preg_match("/w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*/", $email)) {
echo "Sorry you did not add a correct e-mail. <br>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($comments == "") {
echo "Sorry you did not add a any comments. <br>";
echo "<a href='javascript:history.back(1);'>Back</a>";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail("[email protected]",$email,$comments,"From: $email")) {
echo "Thank you for sending your Comments. Someone will get back to you within 24 hours";
} else {
echo "Sorry $email we can not send form.";
}
?>
0.1.9 — BETA 5.19