Html Code (index.html)
<div id="stable" class="center-div" >
<form method="POST" action="send.php">
<input type="text" name="FNAME" value="FIRST NAME" size="20" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">
<!--<input type="text" name="LNAME" value="LAST NAME" size="20" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">-->
<input type="text" name="Email" VALUE="EMAIL" size="20" style="font-size:13px; height:50px; background-color:#f5f5f5"onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">
<input type="submit" value="Submit" name="Submit" class="button">
</div>
</form>
Php code (send.php)
<?php
## CONFIG ##
# LIST EMAIL ADDRESS
$recipient = "admin@gmail.com";
# SUBJECT (Subscribe/Remove)
$subject = "Someone wants updates!";
# RESULT PAGE
$location = "index.html";
## FORM VALUES ##
# SENDER - WE ALSO USE THE RECIPIENT AS SENDER IN THIS SAMPLE
# DON'T INCLUDE UNFILTERED USER INPUT IN THE MAIL HEADER!S
$sender = $recipient;
# MAIL BODY
$body .= "Name: ".$_REQUEST['FNAME']."
";
$body .= "Email: ".$_REQUEST['Email']."
";
# add more fields here if required
## SEND MESSGAE ##
mail( $recipient, $subject, $body, "From: $sender" ) or die ("Mail could not be sent.");
## SHOW RESULT PAGE ##
header( "Location: $location" );
?>
- I want to display a thank you message once the person has successfully filled in the form
- I want to check for correct email id eg. if "@" and ".com" has been entered
- would it be possible to save the entries to another php or text file ? after the email has been sent ?
Thanks in advance for all replies!