Thanks "Bmay" <bmay@bmay.hopto.org> wrote in message 3FC104BB.80505@bmay.hopto.org">news:3FC104BB.80505@bmay.hopto.org... > Nik wrote: > > >OK Guys, > >It's me a again. My problem now is when I click the submit button, the URL > >to my php script file is being displayed. That is I have a script doing some > >validation, and when the user clicks the submit button if there is error in > >the way the entered their information my url changes to match the location > >of my php script file. I wish for it to go back to the original url. > > > > > IMHO a better way to solve your problem is to put the validation PHP > code in the html form page with the page posting to itself. The logic > could then be: > > if form variables are present > verifiy > if error > display warning where you have an error in your form > else > redirect imediately to the next page (<META HTTP-EQUIV="REFRESH" > CONTENT="0;URL=http://your next page urll"> i think) > endif > else // first acces to the page or redirect after error content page > display form page > endif > > The use of template engine permit some nice reuse of original html form > page. > > b. > > PS: an easier way is to simply code a redirect in error page header: > <META HTTP-EQUIV="REFRESH" CONTENT="10;URL=http://your form page url"> > witch display your error page 10s and redirect to the form page > > >************* Start of script *** > > > ><?PHP > > > > //this file is used to verify the user credentials > > > > include "db.inc"; > > > > session_start(); > > $login_username = $_POST['user_name']; > > $login_pass = $_POST['_password']; > > > > $user_check = mysql_query("SELECT username FROM users WHERE > >username='$login_username'"); > > if (mysql_num_rows($user_check) > 0) > > { > > $pass_check = mysql_query("SELECT username,password FROM users WHERE > >username='$login_username' AND password=MD5('$login_pass')"); > > if (mysql_num_rows($pass_check)>0) > > { > > //put code here to access complaints page and > > //start session > > > > session_register('login_name'); > > $_SESSION['login_name'] = $login_username; > > header("Location: issues.php"); //This is when it is successful. I > >manage to change the URL when the login is successful. > > //include "issues.php"; > > > > } > > else > > { > > include "header.php"; > > echo "There seems to be an error with your password. Kindly re-enter > >your correct password. Thank you!"; > > // header("Location: login.php"); I can't use this since I can't get to > >write the error on the page > > include "login.html"; //and this is allowing it to keep the url of > >the PHP file which is this file > > } > > } > > else > > { > > include "header.php"; > > echo "The specified user name does not exists. Kindly register. Thank > >you!"; > > include "signup.html"; > > include "footer.php"; > > } > >?> > > > > > >*********** end of script ********* > > > > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php