Hi! I recently had trouble with something like this but I figured it out. What I want to know now is if my code is correct. I can’t check this for another 2 weeks so could I have some help? GREAT!
This is my PHP code
<?php
// my email
$form_admin_email = "********@yahoo.com";
// my subject
$form_subject = "FEEDBACK";
// the mail() function
mail($form_admin_email, $form_subject, $form_user_message, "From: " . $form_user_email);
// form_user_message.length... is that right???
if ($form_user_message.length >= 5000) {
$form_message = "Please input a message less then 5000 characters.";
} else if ($form_user_message.length <= 10) {
$form_message = "Please input a valid message.";
} else if ($form_user_email.length <=5) {
$form_message = "Please input a valid email address.";
}
// is the next line correct? I'm not sure, im guessing a little
else if (form_email.submit = true) {
$form_message = "Thanks for the email. I'll get back to you in a couple of days./n<br /><br />Your Name: " . $form_user_name . "<br /><br />Your Email: " . $form_ser_email . "<br /><br />Your Message: " . $form_user_message;
} else {
$form_message = "Email me through this form! Please give me a proper email address so I may reply back.";
}
?>
<!-- the PHP_SELF is the document itself... right? -->
<form method="post" name="form_email" action="<?php echo($PHP_SELF) ?>">
Name:<br />
<input type="text" maxlength="100" id="form_user_name" /><br />
*Email:<br />
<input type="text" maxlength="100" id="form_user_email" /><br />
*Message:<br />
<textarea cols="50" rows="5" wrap="hard" id="form_user_message"></textarea><br />
<input type="submit" value="Send Mail" />
</form>
I commented the PHP and the HTML if that helps. If this code works correctly then I just made my own really cool form! NICE!
Reply back soon
~RON
Edit
- Changed $form_user_email to $form_user_email.length
- Got rid of "var =". Confused PHP with Flash.
- Fixed $PHP_SELF Variable