Jump to content

need help with username & password length's, and checking Email & confirm email


Mythic Fr0st

Recommended Posts

Well, Im making a signup page, and I need to check that the username & password is greater than 4 characters, I need it to highlight the actual name of the box in which there was an error

E.G

Username: Pue
[color=red]Username[/color]:

I also need it to confirm that email text is equal to confirm emails text, I have an idea on how to do this but not 100% sure

any help appreciated
WOH! you mean you can check before it sends?

Im using $_POST['name'] on another page, but its not working to well,
(Trying to check if 2 entered boxes are equal)

Can you tell me how to validate it before page changes, so incase they're not right, it doesnt...

:)
[code]
<?
$name = $_POST['name'];
$name2 = $_POST['name2'];

// Check For Match
if ($name != $name2)
{
    echo "The username you entered does not match! Try again...";
}
// Check Length
elseif (strlen($name) < 4)
{
echo "The username you is too short. Try again...";
}
?>
[/code]

Try this, should work just change the second $_POST['name2'] to the name of your second form field. I'd recommend javascript though...
You can use javascript to check to see if they are correct before submitting the page - warning box will popup and say "____ Fields do not match"

Or if you wanted to check to see if the username/email/whatever is already in a database, you could use AJAX which is a little more complex

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.