FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » My contact form is not emailed to me
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
My contact form is not emailed to me [message #173506] Sat, 16 April 2011 07:36 Go to previous message
nathanir is currently offline  nathanir
Messages: 3
Registered: April 2011
Karma:
Junior Member
I have a contact form on my contact page.I can fill in the form and
when I click the submit button, I am redirected to the success page
but I dont receive an email. I did a test with a simple php mail test
form and that works! I have been at it for some time trying to find
the error. Please help
The relevant code is: (for the contact form)
<form action="process-form.php" method="post" enctype="application/x-
www-form-urlencoded" target="_blank" id="formMail">
<span id="textNameField">
<label for="name"></label>
<input type="text" name="name" id="name" />
<span class="textfieldRequiredMsg">A value is required.</
span><span class="textfieldMinCharsMsg">Minimum number of characters
not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum
number of characters.</span></span><span id="textEmailField"><br />
<br />
<label for="email"></label>
<input type="text" name="email" id="email" />
<span class="textfieldRequiredMsg">A value is required.</
span ><span class="textfieldInvalidFormatMsg">Invalid format.</
span><span class="textfieldMinCharsMsg">Minimum number of characters
not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum
number of characters.</span></span>
</p>
<p>&nbsp;</p>
<p><span id="SelectionText">
<label for="select">Purpose</label>
<select name="select" id="select">
<option value="Appointment" selected="selected">Appointment</
option>
<option value="Comment">Comment</option>
<option value="Question">Question</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></
span></p>
<p><span id="textinput">
<textarea name="textinput" id="textinput" cols="45"
rows="5"></textarea>
<span id="countsprytextarea1">&nbsp;</span><span
class="textareaRequiredMsg">A value is required.</span><span
class="textareaMinCharsMsg">Minimum number of characters not met.</
span><span class="textareaMaxCharsMsg">Exceeded maximum number of
characters.</span></span></p>
<p>
<input type="submit" name="submit" id="submit"
value="Submit" />
<input type="reset" name="reset" id="reset" value="Reset" /
>
</p>
<p>&nbsp;</p>
</form>
the processing php form has this code

<?php
// Pick up the form data and assign it to variables
$name = check_input($_POST['name']);
$email = check_input($_POST['email']);
$select = $_POST['select'];
$textinput = check_input($_POST['textinput']);


// Build the email (replace the address in the $to section with your
own)
$ToEmail = 'rajesh(at)childsurgeon(dot)com';
$Emailsubject = "New message: $select";
$MESSAGE_BODY = "$name said: $textinput";
$mailheader = "From: $email";

// Send the mail using PHPs mail() function
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader);

// Redirect
header("Location: success.html");

function check_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: doctype not found?
Next Topic: Re: Weird stuff
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 23:49:23 GMT 2024

Total time taken to generate the page: 0.04119 seconds