Sunday 5 June 2011

How do I get a protected page which requires the linked pages to come from a redirect after submitting a form?

I am using PHP and MySQL to keep scores for online golf. There are 2 pages protected and are accessible from the opening members page. These pages are added through an admin panel which link them from an include that adds: index?access=page. 1 of the pages is a report form that I wish to redirect, after submitting, to the results page which has the info that was submitted. Everything works great except for after hitting the submit button the entries are inserted to the database but the page will not redirect to the results. If i change the action to ../results this brings up the results but doesn%26#039;t put any entries in database. The redirect is done with .htaccess, redirect and index includes. Any suggestions would be helpful.|||Have you tried using a session cookies?





SESSION_COOKIES





on the first page:


%26lt;?php








session_start();


$_SESSION[%26#039;username%26#039;] = %26#039;test%26#039;;


$_SESSION[%26#039;email%26#039;] = %26#039;test@yahoo.com%26#039;;





?%26gt;








on the redirect page (must be on same domain):





%26lt;?php





session_start();





?%26gt;


%26lt;!DOCTYPE HTML PUBLIC %26quot;-//W3C//DTD HTML 4.01 Transitional//EN%26quot; %26quot;http://www.w3.org/TR/html4/loose.dtd%26quot;%26gt;


%26lt;html%26gt;


%26lt;head%26gt;


%26lt;title%26gt;Untitled Document%26lt;/title%26gt;


%26lt;meta http-equiv=%26quot;Content-Type%26quot; content=%26quot;text/html; charset=iso-8859-1%26quot;%26gt;


%26lt;/head%26gt;


%26lt;body%26gt;


%26lt;?php








print(%26quot;Welcome back {$_SESSION[%26#039;username%26#039;]}%26quot;);





?%26gt;








to unset the session cookies:





%26lt;?php





session_start();


//session_destroy();


session_unset($_SESSION);


?%26gt;