Hi Friends, I am enclosing both the html and php scripts of my web form. I need the script for replacing the message “thanks for submitting…” with a web page redirection and data should be submitted to email address.
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
Full Name: <input type="text" name="name" size="25"><br>
Email ID: <input type="text" name="email" size="25"><br>
Phone Number:
<input type="text" name="phone" size="12">
<p>Comments: </p>
<p style="text-align: left">
<textarea rows="4" name="comments" cols="57"></textarea> <br>
<p style="text-align: left">
<input type="submit" value="Submit" name="submit">
<input onClick="reset(); return false;" type="reset" name="Reset"> </span></td>
</p>
</body>
</html>
PHP Script
<?php
if(isset($_POST['submit'])) {
$to = "test@gmail.com";
$subject = "BCT Contact";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$phone_field = $_POST['phone'];
$message = $_POST['comments'];
$body = "Name: $name_field
Email: $email_field
Phone: $phone_field
Comments:
$message";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
echo "blarg!";
}
?>