Firstly, l am very new to creating html and php codes in websites, so if this may seem a trivial question to some on here please appreciate that l require a bit of help. Thanks
I have created a login username and password form for just one user (html form) to work in conjunction to a .php code, it works perfectly.
Current:
- It will not allow the form to submit if either username and/or password fileds are blank.
- incorrect username and/or password displays the echo ("incorrect"); text on the www.......com/login.php page.
- When both username and password filed are entered correctly it redirects to the required page.
EDIT WANTED:
- Instead of the displaying the echo ("incorrect"); text on the www.......com/login.php page. I want "incorrect" to to be displayed underneath or within the html form. This saves going back to the original page each time to redo the entries.
Thank you.
HTML FORM:
<fieldset>
<legend>Login</legend>
<label for="username" >UserName: </label>
<input type="text" id="username" name="username" required="true" />
<label for="pass" >Password:</label>
<input type="password" id="pass" name="pass" required="true"/>
<input type="submit" name="Submit" value="Submit" />
<include'login.php'/>
</fieldset>
</form>
login.php
<?php
if(($_POST['username'] == "user1") && ($_POST['pass'] == "pass1"))
{
header("Location:http://www.yahoo.com");
}
else
{
echo ("incorrect");
}
?>