tet3828 Posted November 9, 2006 Share Posted November 9, 2006 I have this simple script here: it validates a password/username and moves on to the database modification page (modify.php). I need it to move to the next page only if the password/username match.. (without the user having to click a link or okay button.) how would I do this?[code]if (******* == "".$_POST['userName']."" & ******* == "".$_POST['userPass']."") { echo "Username and password have been validated, thank you..."; echo "Entering Database";[/code]so I would soppose the code to launch open the next page should be within my if brackets.Someone suggested putting a header & location at the top of the page. but I don't understand how that would complete the task. Link to comment https://forums.phpfreaks.com/topic/26653-proceeding-to-next-page-after-validation/ Share on other sites More sharing options...
bqallover Posted November 9, 2006 Share Posted November 9, 2006 You can use header( "Location: xxxx" ) anywhere in your script, as long as no output has been sent to the browser beforehand, i.e. echo, print, etc. Link to comment https://forums.phpfreaks.com/topic/26653-proceeding-to-next-page-after-validation/#findComment-121934 Share on other sites More sharing options...
tet3828 Posted November 9, 2006 Author Share Posted November 9, 2006 so you would suggest.... doing away with my echo and just using that header(location) command to go stright to the next page?would any of this information at the top of the page interfere with the header:location redirrect?[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Validation</title></head><body><?php[/code] Link to comment https://forums.phpfreaks.com/topic/26653-proceeding-to-next-page-after-validation/#findComment-121943 Share on other sites More sharing options...
bqallover Posted November 9, 2006 Share Posted November 9, 2006 Hmmm. That would render the header command useless, as output has already been sent. Is there any particular reason you want to display a page that says 'Validating...'? Seems a bit superfluous. :) Link to comment https://forums.phpfreaks.com/topic/26653-proceeding-to-next-page-after-validation/#findComment-121976 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.