473,396 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Parse error: syntax error, unexpected T_STRING

3
Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2. <title>Submit a URL</title>
  3. </head>
  4. <body>
  5. <?php
  6.  
  7. $message = '<font color = "red">The following errors occured: <br/>';
  8. $problem = FALSE;
  9.  
  10. if(!eregi("^[[:alpha:].'-] {4,} $", stripslashes(trim($_POST['name'])))) {
  11.     $problem = TRUE;
  12.     $message = '<p>Please enter a valid name(at least 4 characters)</p>;
  13. }
  14.  
  15. if(!eregi("^[[:alnum:]] [a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", 
  16. stripslashes(trim($_POST['email'])))) {
  17.     $problem = TRUE;
  18.     $message = '<p>Please enter a valid URL category</p>';
  19. }
  20.  
  21. if (!isset($_POST['url_category']) OR !is_numeric($_POST['url_category'])){
  22.     $problem=TRUE;
  23.     $message='<p>Please enter a valid URL category</p>';
  24. }
  25.  
  26. if (!$problem){
  27.     echo '<p>Thank you for the URL submission.</p>';
  28. }else{
  29.     echo $message;
  30.     echo '</font><p>Please go back and try again</p>';
  31. }
  32. ?>
  33. </body>
  34. </html>
  35.  
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\lab8q2\handle_submit_url.php on line 16
Mar 29 '11 #1
2 907
Hi

Replace your code with the below code

Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2. <title>Submit a URL</title>
  3. </head>
  4. <body>
  5. <?php
  6.  
  7. $message = '<font color = "red">The following errors occured: <br/>';
  8. $problem = FALSE;
  9.  
  10. if(!eregi("^[[:alpha:].'-] {4,} $", stripslashes(trim($_POST['name'])))) {
  11. $problem = TRUE;
  12. $message = '<p>Please enter a valid name(at least 4 characters)</p>';
  13. }
  14.  
  15. if(!eregi("^[[:alnum:]] [a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$",
  16. stripslashes(trim($_POST['email'])))) {
  17. $problem = TRUE;
  18. $message = '<p>Please enter a valid URL category</p>';
  19. }
  20.  
  21. if (!isset($_POST['url_category']) OR !is_numeric($_POST['url_category'])){
  22. $problem=TRUE;
  23. $message='<p>Please enter a valid URL category</p>';
  24. }
  25.  
  26. if (!$problem){
  27. echo '<p>Thank you for the URL submission.</p>';
  28. }else{
  29. echo $message;
  30. echo '</font><p>Please go back and try again</p>';
  31. }
  32. ?>
  33. </body>
  34. </html>
  35.  
Thanks,
Mayur Bhayani
Mar 29 '11 #2
eqah
3
thanks, the message came out but i still got error. function eregi() is deprecated. do you know why?
Mar 29 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine...
0
by: badkitty63 | last post by:
I am getting this error Help!!!!!! Parse error: syntax error, unexpected T_STRING in /home/desertr3/public_html/includes/languages/english/shipping.php on line 18 I am trying to add shipping...
36
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My...
3
by: sclarkstone | last post by:
Im getting this error; Parse error: syntax error, unexpected T_STRING, expecting ':' or ';' with this line; header ('postcodesearch.php?e=nw&pcode=',); I cant find whats wrong, can anyone...
2
by: fburn | last post by:
I need some help with an error I'm getting using php 5.2.5 running on linux. I receive an error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or...
3
paulrajj
by: paulrajj | last post by:
hi to all, i am getting syntax error on my code.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs\Dummy\paulraj\matrim\exam.php on line 62 ...
10
by: benicio | last post by:
Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\wamp\www\study_group\includes\functions.php on line 19 I got this error and this syntax is from 8 to 19th line. <?php ...
14
riverdale1567
by: riverdale1567 | last post by:
Hi I am a newbie trying to get some of my first code working, yada yada yada. I have a drop down box which chooses a state then takes the post data to 'processform2.php' to use that to pull up...
4
by: 9139530 | last post by:
Hey, I'm getting the error: Parse error: syntax error, unexpected T_VARIABLE in Z:\home\baza\www\get2.php on line 7 with this code (have 2 pages , html-from page (reguser.php) and...
4
by: tiff zhan | last post by:
the error public function getTable($tableName) { if (!isset($this->_tables)) { $this->_tables = Mage::getSingleton('core/resource')->getTableName($tableName); ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.