I am confused, the php doesnt seem to make sense
<?
if(isset($_POST['submit'])) {
require_once("db_conn.php");
session_start();
$user = $_POST['name'];
$pass = $_POST['pass'];
$result = mysql_query("SELECT * FROM users WHERE name = '$user' AND password = '$pass'") or die(mysql_error());
$row = mysql_fetch_array( $result );
}
?>
<span id="navbar">
<?php
if($row) {
$_SESSION['id'] = $row['id'];
header("Location: editable.php");
exit;
} else {
?>
<div class="buttonwrapper">
<a class="ovalbutton" ahref="#" onclick="showlayer('login_menu')">
<span>Login</span>
</a></div>
<div id="login_menu" style="display:none;">
<!--<div id="new-user-col">New User:<br /><br />
<a href="register.html" class="green-button">Register</a>
</div> -->
<div id="signup-user-col">
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post">
<ul>
<li>
<label for="email">Username:</label>
<input type="text" id="email" size="18" name="name"/>
</li>
<li>
<label for="psw">Password:</label>
<input type="text" id="psw" size="18" name="pass"/>
</li>
<input type="submit" value="Log-in" name="submit"/>
</ul>
</form>
</div>
<div class="spacer"></div>
</div>
<?php } ?>
</span>
<div id="logo"><a href="index.shtml">On The Ocean</a></div>
<ul id="menu">
<li><a href="index.php">Home</a></li>
<li><a href="409.shtml">409</a></li>
<li><a href="708.shtml">708</a></li>
<li><a href="102.shtml">102</a></li>
<li><a href="310.shtml">310</a></li>
<li><a href="avail.shtml">Availability</a></li>
<li><a href="loc.shtml">Location</a></li>
<li><a href="blog">Blog</a></li>
<li><a href="contact.shtml">Contact Us</a></li>
</ul>
the page is here
On The Ocean: Home
Shouldn’t (once the login form is submitted, the if statement,
if(isset($_POST['submit']))[/php} be true and run the code in between. Also, shouldn't the
```php
if($row)
ring true if the login credentials are right and1 record is returned? but it doesn’t seem to work as the
header()
function doesn’t run.
Whats going on here?
Thanks