I am pretty new to PHP, HTML, jQuery and I need some help. I have a php script that I need to activate when I click the submit button. I have it set up to set my session to my username and id. All I really need is a way to update or append a p tag to my div if the information entered is the same as the database.
Here is my code:
<div class="modal-footer">
<input type="submit" name="sumbit" value="Login" class="btn btn-primary" />
<?php
if (isset($_POST["username"])) {
$username = $_POST["username"];
$password = $_POST["password"];
$sql = "select * from users where username = '$username' and password = '$password' limit 1";
$res = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($res)) {
$row = mysql_fetch_assoc($res);
$_SESSION["uid"] = $row["id"];
$_SESSION["username"] = $row["username"];
header("Location: index.php");
} else {
?>
//I want to add the text to my modal body above this code
<?php
}
}
?>
</div>
Also if you haven't notice already I am using bootstrap.
My main problem is I don't know how to run the PHP to check if the info is correct or not and not having the modal close if clicked if it is.