Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think it's best to understand what's going on in a form submission, and dispel the idea that some magic is happening here.</p> <p>With form submissions, you're working with a work flow of sorts: </p> <ol> <li>HTML Form</li> <li>Processing Script</li> <li>Thank You Page.</li> </ol> <p>Each is a page, and the browser must be told to go to each page. Knowing this, if there is ever a problem, you can mentally walk through each step. You can also see this activity by looking a debug tools like Firefox Web Console (CTRL + SHIFT + K), Chrome Developer Tools (CTRL + SHIFT + J), and IE Developer Tools (F12).</p> <p><strong>Step 1 -> Step 2</strong></p> <p>The loading of the page in Step 2, the processing script, is accomplished through the action attribute of the form you have, which it looks like you may already know. However, the URL the form was originally submitting to looked a little funny. It should be pointing to a file on the server, I would expect "contactus.php". With "contactus.php/contactus.php", Apache Web Server must be translating the URL, moving the second "contactus.php" into the querystring.</p> <p>In your example, you changed this action to "thankyou.php", which would effectively skip loading the processing script in step 2 entirely, as was experienced.</p> <p><strong>Step 2 -> Step 3</strong></p> <p>As others have suggested, using PHP's <a href="http://php.net/manual/en/function.header.php" rel="nofollow">header</a> method (<code>header("LOCATION: thankyou.php")</code>) in place of <code>exit("Email sent successfully.");</code> is a good solution. This is telling the browser to go to "thankyou.php" by setting the HTTP header. This is a <code>key: value</code> format, with LOCATION being a special key the browser acts upon.</p>
 

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