Help Mail form PHP

the mail() function

Moderators: macek, egami, gesf

Damien31
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Apr 16, 2012 10:22 pm

Help Mail form PHP

Postby Damien31 » Mon Apr 16, 2012 10:26 pm

Hello,

I'm getting a form undefined and I cannot receive the email. I've created a much simpler version of mobile web page that reproduces the issue, can anyone tell me why I can't receive the email with all the completed fields?
Thank you for your help!!


Html:

form action="send_email.php" method="post" type="text/javascript">

<div data-role="fieldcontain" class="ui-hide-label">
<label for="name">Name:</label>
<input type="text" name="name" id="name" value="" placeholder="Full Name" />
</div>

<div data-role="fieldcontain" class="ui-hide-label">
<label for="phone">Phone Number:</label>
<input type="tel" name="phone" id="phone" value="" placeholder="Phone Number" />
</div>

<div data-role="fieldcontain" class="ui-hide-label">
<label for="email">Email:</label>
<input type="email" name="email" id="email" value="" placeholder="Email"/>
</div>
<div data-role="fieldcontain" class="ui-hide-label">
<label for="location">
Select Locations:
</label>
</div>
<select name="location" id="location" value="" placeholder="location">
<option value="Dashwood House, London">
Dashwood House, London
</option>
<option value="Canary Wharf, London">
Canary Wharf, London
</option>
</select>
<div data-role="fieldcontain" class="ui-hide-label">
<label for="comment">Type in your requirements:</label>
<input type="text" name="comment" id="comment" value="" placeholder="Type in your requirements" />
</div>

<input name="Submit" type="submit" data-theme="e" data-icon="forward" data-iconpos="right" value="Submit" />
<a data-role="button" data-direction="reverse" data-rel="back" data-transition="pop" data-theme="c" href="#page1" data-icon="home" data-iconpos="left">
Cancel
</a>
</form>

PHP:
<?php
function checkSet(){
return isset($_POST['name'], $_POST['email'], $_POST['phone'], $_POST['location'], $_POST['comment']);
};
$to = "myemail@myemail.com";
$subject = "New Lead from PPC landing page";
$body = "Name: ".$_POST['name']."\n".
"Phone: ".$_POST['pphone']."\n".
"Email: ".$_POST['email']."\n".
"Location: ".$_POST['location']."\n".
"Comments: ".$_POST['comment']."\n";
$from = "myemail@domain.com";
$headers = "From:" . $from;
mail($to, $subject, $body, $headers)

?>

User avatar
minimihi
New php-forum User
New php-forum User
Posts: 238
Joined: Sat Apr 14, 2012 11:57 am
Location: Vilnius, Lithuania

Re: Help Mail form PHP

Postby minimihi » Tue Apr 17, 2012 2:24 am

If you're trying to send from local host, read here, it will be good reference even thought you're not on local host


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 4 guests