Jump to content


Photo

Parse Error Need help


  • Please log in to reply
3 replies to this topic

#1 muffin100

muffin100
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 05 April 2006 - 11:54 PM

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.php

Here 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?


#2 heckenschutze

heckenschutze
  • Members
  • PipPipPip
  • Advanced Member
  • 257 posts
  • LocationAustralia

Posted 06 April 2006 - 06:54 AM

Im not sure if this is your error, but it could be it...

You forgot an underscore:
$POST['name']

meaning the line should be:
if(eregi('^[[:alpha:]]\.\'\-{2,15}$', stripslashes(trim($_POST['name']))))
{
 // ...

hth.

#3 vombomin

vombomin
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 06 April 2006 - 10:27 AM

try this maybe

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>';
}

#4 muffin100

muffin100
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 11 April 2006 - 03:27 AM

Tried both ways and the parse error still came out.
Thanks though.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users