I have a basic form, I only want to execute it when user input matches a set Can I create user so that user can supply "username" and password "password 1" if the page can go to the page?
Edit:
To clear the problem.
I am trying to create a form with a username and password input. When the user clicks on this form, then he currently has the user addboo Ks.php.I want to make this conditional so that users can only access addbooks.php page, if user name = "admin" and provide password then provide "password 1". I currently click on the button Try to execute the submission function and submit the submit function if the user name and password match the administrator and password 1. If they do so, then you can add it to addbooks.php
You can try it (note headers ("Location: addBooks.php" ) The part should be at the top of your code, before any HTML output is done):
if (isset ($ _ POST ["user name"]) and continue ($ { _POST ["password"]) {if (($ _POST ["user name"] == "admin") and ($ _POST ["password"] == "password 1") {header ("Location: AdBook Php "); Go out; } Else {echo "Please check the username and password "}}} // Admin login echo & lt; Form method = "post" action = "'. $ _ SERVER [' PHP_SELF ']. & Gt; Username: input type =" text "name =" username "value = "Admin"> Password: Input Type = "Text" name = "password" value = "" & gt; & lt; br /> Input Type = "submit" name = "sbmt" id = "sbmt" value = "submit" class = "user_class" />
No comments:
Post a Comment