Jump to content

Recommended Posts

I am working on putting a simple form on my site but I am unable to figure out how to have the completed form get emailed to the webmaster.

 

Any ideas would be extremely appreciated.

 

Thank you.

 

 

<!-- Form Code-->

 

<form action="send_mail.php" method="post">

<div style="float: left; margin-top: 5px; margin-left: 20px;">

<input class="spotform1" onfocus=" if (this.value == 'Enter your name') { this.value = ''; }" onblur="if (this.value == '') { this.value='Enter your name';} " type="text" name="name" value="Enter your name" />

<div style="clear: both;"></div>

<input class="spotform1" onfocus=" if (this.value == 'Enter phone #') { this.value = ''; }" onblur="if (this.value == '') { this.value='Enter phone #';} " type="text" name="phone" value="Enter phone #" />

<div style="clear: both;"></div>

<div style="clear: both;"></div>

</div>

<div style="float: right; margin-top: 0px; margin-right: 20px;"><span style="float: left; margin-top: 0px; margin-left: 0px;">

<input class="spotform2" onfocus=" if (this.value == 'Enter your email') { this.value = ''; }" onblur="if (this.value == '') { this.value='Enter your email';} " type="text" name="email" value="Enter your email" />

</span>

<div style="clear: both; height: 5px;"></div>

<div align="right"><input class="contact1" style="color: #000; text-shadow: 0 1px 0 0 #fff;" type="image" value="Submit Your Info" /></div>

<div style="clear: both;"></div>

</div>

Php's mail function is great for this

 

<?php
$name = htmlentities($_POST['name']);
$email = htmlentities($_POST['email']);
$phone_number = htmlentities($_POST['phone']);


$mailheaders .= "Ahoy Webmaster! $name has sent you an email.\n";
$mailheaders .= "Their phone number is $phone_number and their email is $email\n";


$to = "$adminemail";
$subject = "Ahoy Webmaster!";

mail($to, $subject, $mailheaders, "From: $name\n");
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.