judacoor Posted June 29, 2007 Share Posted June 29, 2007 Hey everyoneI'm having problems trying to load a new php file, I don't really know how.Here's the thing: I have a login and password input form on one page, wich sends the info to itself after being submitted.So what I do is that everytime the page loads, it first checks if there are $_POST variables available, if there aren't it just loads the form normally to input those variables; if the username and pw are present and are correct as well I want to load the next page, where the user is logged in.But I don't know how open/load a new php file.I tryed using < aref .....<\a> or something like that, but I can't seem to make it work.Please help!! Link to comment Share on other sites More sharing options...
Jamess Posted June 29, 2007 Share Posted June 29, 2007 Hey everyoneI'm having problems trying to load a new php file, I don't really know how.Here's the thing: I have a login and password input form on one page, wich sends the info to itself after being submitted.So what I do is that everytime the page loads, it first checks if there are $_POST variables available, if there aren't it just loads the form normally to input those variables; if the username and pw are present and are correct as well I want to load the next page, where the user is logged in.But I don't know how open/load a new php file.I tryed using < aref .....<\a> or something like that, but I can't seem to make it work.Please help!!<meta http-equiv="refresh" content="1;url=http://google.co.uk">1 represents the number of seconds before your new page will load. After url= should be the full (not relative) adress of your file.. just to keep it simple! Link to comment Share on other sites More sharing options...
judacoor Posted June 29, 2007 Author Share Posted June 29, 2007 Jamess:I've tryed it, but it shows the following error:Parse error: syntax error, unexpected '<'What would it be? Link to comment Share on other sites More sharing options...
teng84 Posted June 29, 2007 Share Posted June 29, 2007 can i see the code Link to comment Share on other sites More sharing options...
judacoor Posted June 29, 2007 Author Share Posted June 29, 2007 <?php include('../Connections/conn2.php');$login= $_POST["user"];$pw = $_POST["pw"];$link=Connection();//A function within conn2.phpif($login!=null&&$pw!=null){ $result = mysql_query("SELECT * FROM `users` WHERE `users`.`login` = '$login'",$link); if($result!=null){ while($row = mysql_fetch_array($result)){ if($row["password"]==$pw){ session_start(); $_SESSION['id_user']=$row["id_user"]; <meta http-equiv="refresh" content="1;url=http://localhost/TestSite/menu.php"> } else{ echo "User NOT found","<br>"; } } else{ echo "Usuario NO encontrado","<br>"; }}?>But I can't get it to open the new link, after the server verifies the user name and password!!!!What can I do??? Link to comment Share on other sites More sharing options...
teng84 Posted June 29, 2007 Share Posted June 29, 2007 <?phpsession_start();include('../Connections/conn2.php');$login= $_POST["user"];$pw = $_POST["pw"];$link=Connection();//A function within conn2.phpif($login!=null&&$pw!=null){$result = mysql_query("SELECT * FROM `users` WHERE `users`.`login` = '$login'",$link); $row = mysql_fetch_assoc($result); if($row["password"]==$pw) { $_SESSION['id_user']=$row["id_user"]; header('location:http://localhost/TestSite/menu.php'); exit(); }}?> hoooo you alot of error try that first then add some missing litle by litle to avoid from breaking down that code Link to comment Share on other sites More sharing options...
justsomeguy Posted June 30, 2007 Share Posted June 30, 2007 You can't just write HTML in the code. You have to use echo or print to send text.echo "<meta http-equiv=\"refresh\" content=\"1;url=http://localhost/TestSite/menu.php\">"; Link to comment Share on other sites More sharing options...
judacoor Posted June 30, 2007 Author Share Posted June 30, 2007 Thanks guysThat has really helped me out!! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.