Alrighty, IM A NOOB 19hrs PHP experience🙂
Now, firstly, this is my main setup...
( The Making & naming etc.. of buttons )
<html>
<body>
<head>
<style type="text/css">
body
{
background-image:
url('SilverBG.jpg')
}
</style>
</head>
<img src="Gaming Ink Banner.jpg" width="1008" height="125">
<form action="Youhavebeene-mailed.php" method="post">
<div align='center'>
<font size='5'>Signup </font> <br/> </br> </br>
<font size='4'>Please enter your details below.</br> Any field with the <font color='blue'>*</font>
symbol is a required field.</br>
<table border='0'>
<tr>
<td><b><font color='blue' size='4'>*</font>Username:</b></td>
<td><input type='text' name='user'></td>
</tr>
<tr>
<td><b><font color='blue' size='4'>*</font>Password:</b></td>
<td><input type='password' name='pw1'></td>
</tr>
<tr>
<td><b><font color='blue' size='4'>*</font>Confirm Password:</b></td>
<td><input type='password' name='pw2'></td>
</tr>
<tr>
<td><b><font color='blue' size='4'>*</font>E-mail:</b></td>
<td><input type='text' name='email1'></td>
</tr>
<tr>
<td><b><font color='blue' size='4'>*</font>Confirm E-mail:</b></td>
<td><input type='text' name='email2'></td>
</tr>
<tr>
<td><b><font color='blue' size='4'>*</font>Gender:</b></td>
<td><b>Male</b><input type='radio' name='gen'>
<b>Female</b><input type='radio' name='gen'></td>
</tr>
</table>
<input type='submit' value='Signup'>
</form>
<!-- 51 -->
<!-- Above is ALL banner, and the signup button stuff ++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
</body>
</html>
Now, this is the code that matters, the one that results in an error or your account being created and sent your details & activation code to you
<html>
<head>
<style type="text/css">
body
{
background-image:
url('SilverBG.jpg')
}
</style>
</head>
<img src="Gaming Ink Banner.jpg" width="1008" height="125">
<div align='center'>
<body>
<?php
if (strlen($_POST['user']) > 4)
{
$email[1]=$_POST['email1'];
$email[2]=$_POST['email2'];
$pw[1]=$_POST['pw1'];
$pw[2]=$_POST['pw2'];
$bool[1]=true;
$bool[2]=true;
if ($email[1] == $email[2])
{
echo " <b>Your e-mail's match</b> <br/>";
}
else
{
echo "<b><font color='darkblue' size='4'>Your e-mail's do not match</font></b></br>";
$bool[1]=false;
}
if ($pw[1] == $pw[2])
{
echo "<b>Your passwords match</b>";
}
else
{
echo "<b><font color='darkred' size='4'>Your password's do not match</font></b>";
$bool[2]=false;
}
if ($bool[1] == true && $bool[2] == true)
{
$msg='<font color="darkred" size="4">Welcome to Mythic Aeons</font>';
$subject='Activation Code';
$from='MythicAeons@yahoo.com.au';
$headers='From: '.$from;
mail($_POST['email1'],$subject,$msg,$headers);
echo '<font color="blue" size="4">Your details have been e-mailed to you</font>';
}
}
else
{
echo '<font color="blue" size="4">Error:</font><font color="blue" size="3"><i> Your username must be atleast 5 characters long</i></font>';
}
?>
</body>
</html>
if you look closely
you should realize, that this checks the length of the textbox 'user' and if its greater then 4, it does the actions its suppost to (mailing your details to you)
if its not greater then 4 (aka less than 5) it will display an error
My question is, how can I get it to display multiple errors
E.G,
if The textbox username has less than 5 characters
an error will come up
but I ALSO want along with that
if the password boxes (both confirm (pw2) & normal (pw1))
are less than 5 characters
Another error message appears, for each one of them
so it'd look like this
Error: username must be atleast 5 chars
Error: password must be atleast 5 chars
Error: confirm pasword must be atleast 5 chars
( this appears on the Youhavebeene-mailed.php page )
can someone help me with this, If I try to get it to work for more than just username I get big problems O_O