Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot redirect after form submission
    primarykey
    data
    text
    <p>I have a form on a HTML page that has form data, and would like to have the user redirected to a new URL page after they have pressed the submit button and it has emailed the information. The form is called with the following button.</p> <pre><code>&lt;div class="btnp"&gt;&lt;input type="submit" value="Continue to Billing" &gt;&lt;/div&gt; </code></pre> <p>The form then sends the data to my PHP file via post. I do not need a success echo message, I would just like the URL to be redirected to the payment page. Below is the PHP file I have set up. I am trying to submit, send email with form date, and then redirect to a new html url. </p> <pre><code>&lt;?php //Retrieve form data. //POST $URL = "http://www.google.com"; $fname = $_POST['fname']; $zip = $_POST['zip']; $phone = $_POST['phone']; $email = $_POST['email']; //recipient - change this to your name and email $to = 'sales@mysite.com'; //sender $from = $fname . ' &lt;' . $email . '&gt;'; //subject and the html message $subject = 'New User: ' . $fname; $message = ' &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;table&gt; &lt;tr&gt;&lt;td&gt;First Name&lt;/td&gt;&lt;td&gt;' . $fame . '&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Zip&lt;/td&gt;&lt;td&gt;' . $zip . '&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Telephone&lt;/td&gt;&lt;td&gt;' . $phone . '&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Email&lt;/td&gt;&lt;td&gt;' . $email . '&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt;'; //send the mail $result = sendmail($to, $subject, $message, $from); if ($_POST) if ($result) header('Location: '.$URL); else echo 'Sorry, unexpected error. Please try again later'; //Simple mail function with HTML header function sendmail($to, $subject, $message, $from) { $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: ' . $from . "\r\n"; $result = mail($to,$subject,$message,$headers); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload