Jump to content

trying to use strlen to get length of username & pw & email ( Error )


Mythic Fr0st

Recommended Posts

I get a parse errror

Parse error: parse error in c:\program files\easyphp1-8\www\test\signup.php on line 57

im trying to get the string length of the text boxes, username, password, password confirm, and same for email,

I want it to stop if they dont match, I think im using strlen wrong though...
[code]
<input type='submit' value='Signup' onsubmit='DM()'>[/code]


[code]<?php
function DM()
{
$i=(!strlen('user'))
$pw[1]=(!strlen('pw1'))
$pw[2]=(!strlen('pw2'))
$em[1]=(!strlen('email1')
$em[2]=(!strlen('email2')
}
?>[/code]

im trying to set (!strlen('NameOfTXTbox')) to a variable called $i, but I get error :/, neeed this fixed badly, Can anyone help?
Link to comment
Share on other sites

Okay, your code works, but I need it to stop the browser immediately from continuing
[code]function checkLength($user, $minLength)
{
      if (strlen($user) < $minLength)
      {
              return false;
      }
      else
      {
              return true;
      }
}

if (!checkLength($_POST['user'], 4))
{
        echo 'Your username requires atleast 5 characters';
}
?>[/code]

what code do I use for that?
Link to comment
Share on other sites

SO exit() will just basically, pause the browser and leave it on the same page?

and redirect thing, will take it back to the same page, with a new error... hmm, Redirect sounds good!

and, whenever I click refresh, if username & password boxes, arent atleast 5 chars, or passwords & e-mails dont match, it displays it, anyway to make it redirect back to the browser, and display them then?
Link to comment
Share on other sites

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.