Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I redirect to another page in php
    primarykey
    data
    text
    <p>guys I'm pretty new for php i'm trying to make a login page.</p> <p>How can I redirect page if statement is true?</p> <p>I tried iwth header("location: nextpage.php"); but it doesn't work</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Uploader&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="index.php" method="POST" enctype="application/x-www-form-urlencoded"&gt; &lt;input id="login" class="username" type="text" name="username" autofocus placeholder="Username" maxlength="30"/&gt; &lt;input id="login" class="password" type="password" name="password" placeholder="Password" maxlength="15"/&gt; &lt;input id="login" class="submit" type="submit" value="Login" /&gt; &lt;p&gt;Last update &lt;span id="lastupdate"&gt;&lt;?php echo date('d-m-Y');?&gt;&lt;/span&gt;&lt;/p&gt; &lt;?php mysql_connect("localhost", "root","******") or die(mysql_error()); mysql_select_db("login") or die(mysql_error()); if(isset($_POST['username']) &amp;&amp; isset($_POST['password'])){ $db_user = mysql_query("SELECT username FROM login_tb"); $db_pass = mysql_query("SELECT password FROM login_tb"); $ctrl_user = mysql_result($db_user,0); $ctrl_pass = mysql_result($db_pass,0); $username = $_POST['username']; $password = $_POST['password']; echo $username . $password; if(($username || $password) == NULL){ echo "you have entered wrong username or password! &lt;br/&gt; please contact site admin."; }else{ if($username == $ctrl_user &amp;&amp; $password == $ctrl_pass){ header("location: ./nextpage.php"); } } } ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>please anyone can help me? thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload