I added the else statement you were talking about and it took care of that. I tested the script by first leaving all the text fields blank to make sure it would echo that I left them blank, yet it didn't pick that up at all. Instead it echoed that I registered and stored the blank fields in the database as a registered member.
I also receive this message which I know what it means but don't know how to fix it:
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in c:\program files\easyphp1-8\www\register.php on line 19
Also, I wanted to be able to have a way to check and see if the username is already taken when a user signs up rater than having it say Duplicate entry 'asdf-asdf' for key 2 which is what it currently says. Below is the code edited, I would deeply appreciate any help. Thank you.
register.php
<?
session_start();
include("config.php");
if (is_null($_POST['first_name'])) {
echo "<font color=#ff0000>Please specify your first name.</font>";
} elseif(is_null($_POST['last_name'])) {
echo "<font color=#ff0000>Please specify your last name.</font>";
} elseif(is_null($_POST['email'])) {
echo "<font color=#ff0000>Please specify your last name.</font>";
} elseif(is_null($_POST['username'])) {
echo "<font color=#ff0000>Please specify a username.</font>";
} elseif(is_null($_POST['password'])) {
echo "<font color=$ff0000>Please specify a password.</font>";
} else {
$pw = md5('password');
mysql_query("INSERT INTO members (first_name,last_name,email,username,password) VALUES ('$_POST[first_name]','$_POST[last_name]','$_POST[email]','$_POST[username]','$pw')")or die(mysql_error());
mail($_POST['email'], "You have registered", "Hello ".$_POST['username']." You have registered on http://domain.com Your username is ".$_POST['username']." and your password is ".$_POST['password']."","From:
$emailadres\r\n" ."Reply-To: blah@blah.com\r\n");
echo "You've been registered!";
}
?>
the form
<form action="register.php" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><div align="right">First name: </div></td>
<td><input name="first_name" type="text" id="first_name"></td>
</tr>
<tr>
<td><div align="right">Last name: </div></td>
<td><input name="last_name" type="text" id="last_name"></td>
</tr>
<tr>
<td><div align="right">E-mail address: </div></td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td><div align="right">Desired username:</div></td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td><div align="right">Desired password:</div></td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input name="signup" type="submit" id="signup" value="Signup">
<input name="clear" type="reset" id="clear" value="Clear">
</div></td>
</tr>
</table>
</form>