Hi I'm making a php page that return to itself when submitting form, but there's a case inside the php that when it's true a header("Location: url") function should be performed.
Is it possible to do so?
<form action="" method="post">
<input type="text" name="username" value="" />
<?php
if (isset($_POST['submitted'])) {
$username = $_POST['username'];
$qryS="SELECT * FROM student WHERE ID='$username';";
$resultS=mysql_query($qryS);
if($resultS){
if(mysql_num_rows($resultS)>=1) {
header("location: studentprofile.php");
}}
else {
echo"<p><small> There was an error</p>";
}
}
?>
<input type="submit" name="submitted" value="Submit" /></p>
</form>