muffin100 Posted April 5, 2006 Share Posted April 5, 2006 I'm trying to write a register page and this parse error came out:Parse error: syntax error, unexpected '[' in /usr/local/apache2/htdocs/register.phpHere is part of the code:if (eregi ('^[[:alpha:]]\.\'\-{2,15}$',stripslashes(trim($POST['name'])))) {$n = escape_data($_POST['name']);} else {$n = FALSE ;echo '<p><font color="red" size="+1">Please enter a user name!</font></p>';}I thought it is the single quotes problem so I have tried this:if (eregi ('^[[:alpha:]]{2,15}$',stripslashes(trim($POST['name'])))) {$n = escape_data($_POST['name']);} else {$n = FALSE ;echo '<p><font color="red" size="+1">Please enter a user name!</font></p>';}but the same error popped up, can anyone tell me what the problem is? Quote Link to comment Share on other sites More sharing options...
heckenschutze Posted April 6, 2006 Share Posted April 6, 2006 Im not sure if this is your error, but it could be it...You forgot an underscore: [code]$POST['name'][/code]meaning the line should be:[code]if(eregi('^[[:alpha:]]\.\'\-{2,15}$', stripslashes(trim($_POST['name'])))){ // ...[/code]hth. Quote Link to comment Share on other sites More sharing options...
vombomin Posted April 6, 2006 Share Posted April 6, 2006 try this maybeif (eregi ('^[ :alpha: ]{2,15}$',stripslashes(trim($POST[ 'name' ]))) {$n = escape_data($_POST['name']);} else {$n = FALSE ;echo '<p><font color="red" size="+1">Please enter a user name!</font></p>';} Quote Link to comment Share on other sites More sharing options...
muffin100 Posted April 11, 2006 Author Share Posted April 11, 2006 Tried both ways and the parse error still came out.Thanks though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.