php - Redirect a user back to the page they where on before submitting the form -


i user redirect page on before submitting contact form, after have landed on thank you page on wordpress site.

when user submits form, form redirects thank you page.

on thank you page, redirected page on before submitted contact page.

  1. main contact form

  2. thank page

  3. redirect user page before contact page

if create variable , store refer contact us page:

$referer = $_server['http_referer']; 

then carry on thank you page

if ($referer == '/contact-us'); 

when on thank you page, want redirected after 4 seconds page on, before submitted form on contact page.

use either header() or meta refresh on thank page.

header("refresh:5;url=" . $_server['http_referer']); 

or

<meta http-equiv="refresh" content="5; url=<?php echo $_server['http_referer']; ?>"> 

i advise checking on server['http_referer'] before using method little flaky.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -