owl Posted April 25, 2009 Share Posted April 25, 2009 Hi Experts,I validate a form on a webpage ( on server side using php ) by posting the form data on to the same page.if the form validation is successful, then i have to direct the user to a new page.can you suggest how this can be done using php.-Owl Link to comment Share on other sites More sharing options...
siberneil Posted April 26, 2009 Share Posted April 26, 2009 Hi Experts,I validate a form on a webpage ( on server side using php ) by posting the form data on to the same page.if the form validation is successful, then i have to direct the user to a new page.can you suggest how this can be done using php.-OwlThis is exactly what I have been working on. The method I use is this://Start of page<?phpif (isset($_POST['Any form field']){ //server side validation code?> <html> <head> <META HTTP-EQUIV="refresh" CONTENT="5;URL=another-page.html"> </head> <body> <!--WEB page content stating the user will be redirected in 5 seconds--> </body> </html>}else{?> <html> <!--WEB page with form--> </html><?php}?>the number after CONTENT is the number of seconds of the delay and the URL is the webpage the user will be taken to after those 5 seconds elapse. Link to comment Share on other sites More sharing options...
Synook Posted April 26, 2009 Share Posted April 26, 2009 If you want an invisible refresh that requires only one response-body and sends the correct HTTP header (and uses PHP only) you can also use the header() PHP function to send location:another-page.html header("location:another-page.html"); Link to comment Share on other sites More sharing options...
jlhaslip Posted April 26, 2009 Share Posted April 26, 2009 Meta-refresh is not a standards compliant method. The Header tag as per above posting, .htaccess, or a 301 redirect are preferred.*edit for typos* Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.