Unstoppable Domains

Multiple If's

Spaceship Spaceship
Watch

Coolprogram

Established Member
Impact
7
hey guys I have kinda taken a break from coding for about 2-3 months so i was wonderin' how you make multiple if statements...I have an example of a code I am working on it's very very simple I will show you.
PHP:
<html>
<form action="Learn.php" method="POST">
Username:
<br>
<input type="text" name="te" value="Username Here">
<br>
Password:
<br>
<input type="password" name="pwd" value="">
<br>
<input type="submit" name="sub" value="SUBMIT">
</form>
<?php
if ($_POST["te"]=="Username Here")
echo 'You must enter a name';
else
echo $_POST["te"];
?>
I want the password to be "IFED" as well.
-CP

Oh and http://www.genera3d.com/Learn.php <there's the place to see what it does so far
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Do you mean something along the lines of:
Code:
<?php
if ($_POST["te"]=="Username Here") {
     echo 'You must enter a name';
}
else if (something about the password here) {
     do something here;
}
else {
     echo $_POST["te"];
}
?>
 
0
•••
Something like that...But I want it to be like once you enter both Username And Pass it will say something like this.
If it is accepted:
Password(Flip these two around)
Username Accepted.
And if wrong: You must enter a Username. You must enter a password.
-CP
 
0
•••
Hmm, I'm not sure what you want exactly but the code below will thank them if all 3 of these are true
1. pass is not blank
2. name is not blank
3. name is not 'Username Here'

If any one of them are false they are asked to enter name/pass.

PHP:
 <html>
<form action="learn.php" method="POST">
Username:
<br>
<input type="text" name="te" value="Username Here">
<br>
Password:
<br>
<input type="password" name="pwd" value="">
<br>
<input type="submit" name="sub" value="SUBMIT">
</form>

<?php
	if ($_POST["pwd"] && $_POST["te"] && $_POST["te"] != "Username Here") {
		echo 'Thank You For Entering a Username and Password';
	} else {
	  	echo 'Please Enter Your Username and Password';
	}

?>
 
0
•••
Hey TY, I don'tknow if it's what I want just yet because my host is down and I can't use PHP on windows...Doesn't work even after installing it.
-CP B-)
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back