PHP parameter passing -


im new php , having trouble parameter passing in functions. can't function execute properly. function.

     function validateuser($username){            if(!empty($_post))            {                 if(strlen($_post['username']) < 5)                {                    die("please enter valid username");                 }  } 

thanks

the parameter of function pass function when call it. access within function other variable.

function validateuser($username){     if(strlen($username) < 5)      {          die("please enter valid username");      }  } 

you call using value want validate this:

validateuser($_post['username']); 

tip: don't use die() in functions. have them return true or false , have code calls decide how handle error.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -