Parse error: syntax error, unexpected T_STRING

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eqah
    New Member
    • Mar 2011
    • 3

    Parse error: syntax error, unexpected T_STRING

    Code:
    <html><head>
    <title>Submit a URL</title>
    </head>
    <body>
    <?php
    
    $message = '<font color = "red">The following errors occured: <br/>';
    $problem = FALSE;
    
    if(!eregi("^[[:alpha:].'-] {4,} $", stripslashes(trim($_POST['name'])))) {
    	$problem = TRUE;
    	$message = '<p>Please enter a valid name(at least 4 characters)</p>;
    }
    
    if(!eregi("^[[:alnum:]] [a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", 
    stripslashes(trim($_POST['email'])))) {
    	$problem = TRUE;
    	$message = '<p>Please enter a valid URL category</p>';
    }
    
    if (!isset($_POST['url_category']) OR !is_numeric($_POST['url_category'])){
    	$problem=TRUE;
    	$message='<p>Please enter a valid URL category</p>';
    }
    
    if (!$problem){
    	echo '<p>Thank you for the URL submission.</p>';
    }else{
    	echo $message;
    	echo '</font><p>Please go back and try again</p>';
    }
    ?>
    </body>
    </html>
    Parse error: syntax error, unexpected T_STRING in C:\wamp\www\lab 8q2\handle_subm it_url.php on line 16
    Last edited by Banfa; Mar 29 '11, 03:17 PM. Reason: Added [code] ... [/code] tags, please use them round your code.
  • Mayur2007
    New Member
    • Aug 2007
    • 67

    #2
    Hi

    Replace your code with the below code

    Code:
    <html><head>
    <title>Submit a URL</title>
    </head>
    <body>
    <?php
    
    $message = '<font color = "red">The following errors occured: <br/>';
    $problem = FALSE;
    
    if(!eregi("^[[:alpha:].'-] {4,} $", stripslashes(trim($_POST['name'])))) {
    $problem = TRUE;
    $message = '<p>Please enter a valid name(at least 4 characters)</p>';
    }
    
    if(!eregi("^[[:alnum:]] [a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$",
    stripslashes(trim($_POST['email'])))) {
    $problem = TRUE;
    $message = '<p>Please enter a valid URL category</p>';
    }
    
    if (!isset($_POST['url_category']) OR !is_numeric($_POST['url_category'])){
    $problem=TRUE;
    $message='<p>Please enter a valid URL category</p>';
    }
    
    if (!$problem){
    echo '<p>Thank you for the URL submission.</p>';
    }else{
    echo $message;
    echo '</font><p>Please go back and try again</p>';
    }
    ?>
    </body>
    </html>
    Thanks,
    Mayur Bhayani

    Comment

    • eqah
      New Member
      • Mar 2011
      • 3

      #3
      thanks, the message came out but i still got error. function eregi() is deprecated. do you know why?

      Comment

      Working...