PHP cookie/redirect on button click

I was wondering if anyone could give me help with an issue I am having. I am trying to make a Terms of Service page where the user has a splash page when they enter asking if they accept the terms before going. Anyways if they click accept I want it to create a cookie which will then allow them to not see the Terms of Service page anymore aka either by an instant redirect or other method. I have tried a couple methods that dont seem to work. Below is my code.

totest3.php

[code]

Untitled Document test [/code]

totest3_form.php

[code]

Untitled Document <?php setcookie("rstos", "rstos", time()+3600); print "test"; header("Location: http://website.com/index.php"); exit; ?> [/code]

Any help is greatly appreciated, thanks.

Note I am getting Warning: Cannot modify header information - headers already sent by (output started at /home/***/public_html/tostest3.php:9) in /home/***/public_html/tostest3.php on line 11

Sponsor our Newsletter | Privacy Policy | Terms of Service