TheMilkMan28 Posted November 10, 2012 Share Posted November 10, 2012 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> Link to comment https://forums.phpfreaks.com/topic/270526-i-am-a-newby-at-this-have-a-simple-question-for-you/ Share on other sites More sharing options...
MDCode Posted November 10, 2012 Share Posted November 10, 2012 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"); ?> Link to comment https://forums.phpfreaks.com/topic/270526-i-am-a-newby-at-this-have-a-simple-question-for-you/#findComment-1391430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.