Jump to content

I Am A Newby At This & Have A Simple Question For You


TheMilkMan28

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");
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.