Jump to content

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


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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.