PHP Form Help


#1

Hey guys,

I am having an issue with my php form.

I want that when the form has been submitted that it will redirect to a new page, while at the minute it is just saying ‘thank you’ in a div on the same page.

The success code of the form is:

PHP
$success=’’;
if($_SESSION[‘sent’])
{
$success=‘

Thank you!

’;
$css='<style type="text/css">#contact-form{display:none;}</style>';

unset($_SESSION['sent']);

}
?>
ENDPHP
This would be the bit I have to edit yea? I have tried some javascript but when I add the Javascript in, i am just getting a blank page. I have also tried to put window.open on my submit button, but the code above is just over ruling this. Any help would be much appreciated :slight_smile:


#2

What you can do is use sleep(3), then header('Location: index.php"); That’ll tell the script to sleep for 3 seconds, then change pages. change both to match your requirements. You can also skip the sleep and just echo a meta refresh.


#3

you could use meta refresh but its not recommended it has mixed results across browsers best to stick with sleep