I was wondering if I could get some help with PHP. I have a form that works well with serverside PHP. However, when the user hits submit it opens up my "blank" PHP URL. can anyonle help me figure out how I can send an automatic "thankyou.html" upon them pressing "submit" Here is the Form HTML and the PHP is after: <td style="height:233px;"><form method="post" action="http://www.mywebsite.com/cgi-bin/contactx.php" id="form"><table border="0" cellpadding="0" cellspacing="0" style="margin:12px 0 0 18px; width:181px;"> <tr><td><img src="images/7title4.jpg" alt="" style="margin-bottom:17px;"></td></tr> <tr> <td><label> <input name="name" type="text" id="name" value="Name:"> </label></td> </tr> <tr><td><img src="images/spacer.gif" width="1" height="8" alt=""></td></tr> <tr> <td><label> <input name="email" type="text" id="email" value="Email:"> </label></td> </tr> <tr><td><img src="images/spacer.gif" width="1" height="8" alt=""></td></tr> <tr> <td><label> <input name="subject" type="text" id="subject" value="Subject:"> </label></td> </tr> <tr><td><img src="images/spacer.gif" width="1" height="8" alt=""></td></tr> <tr> <td><label> <textarea name="message" id="message" cols="45" rows="5">Message: </textarea> </label></td> </tr> <tr> <td><table border="0" cellpadding="0" cellspacing="0" style="margin:5px 0 0 80px;" class="kn"> <tr> <td width="60" style="width:60px;"><a href="#" onclick="document.getElementById('form').reset()">clear</a><img src="images/ch_1.jpg" style="margin-left:4px; margin-top:5px;" alt=""></td> <td width="39"><a href="#" onclick="document.getElementById('form').submit()">send</a> Here is the PHP <?php // setting variables $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; // sending message to the recipient $to = "myemail@mail.com"; $subject = $_POST['subject']; $msg = $message . $_POST['name'] . $headers = "From: " . $_POST['email'] . "\r\nReply-To:" . $_POST['email']; mail("$to", "$subject", "$msg", "$headers"); ?>
on your result page input this <META http-equiv="refresh" content="0; URL=http://www.vipdesi.com/tube/"> it will redirect ou to the thank you page
<form method="post" action="http://www.mywebsite.com/cgi-bin/contactx.php" id="form"> <input type="hidden" name="redirect" value="thankyoupage.htm" /> Code (markup): try this
Try this.. <?php // setting variables $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; // sending message to the recipient $to = "myemail@mail.com"; $subject = $_POST['subject']; $msg = $message . $_POST['name'] . $headers = "From: " . $_POST['email'] . "\r\nReply-To:" . $_POST['email']; mail("$to", "$subject", "$msg", "$headers"); [B]header("Location: thankyou.html");[/B] ?> Code (markup):