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
Post a Comment