473,756 Members | 8,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parse error: syntax error, unexpected T_VARIABLE

2 New Member
I am gettin a error message on this script can someone help me. I am a complete newbie on this stuff. Thanks in advance for any help you can give me.
here is the error.
Parse error: syntax error, unexpected T_VARIABLE in /home/content/m/i/x/mixxsalon/html/FormToEmail.php on line 1

here is the code.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $my_email = "user@example.com";
  4.  
  5. /*
  6.  
  7. Enter the continue link to offer the user after the form is sent.  If you do not change this, your visitor will be given a continue link to your homepage.
  8.  
  9. If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm"
  10.  
  11. */
  12.  
  13. $continue = "/";
  14.  
  15. /*
  16.  
  17. Step 3:
  18.  
  19. Save this file (FormToEmail.php) and upload it together with your webpage containing the form to your webspace.  IMPORTANT - The file name is case sensitive!  You must save it exactly as it is named above!  Do not put this script in your cgi-bin directory (folder) it may not work from there.
  20.  
  21. THAT'S IT, FINISHED!
  22.  
  23. You do not need to make any changes below this line.
  24.  
  25. */
  26.  
  27. $errors = array();
  28.  
  29. // Remove $_COOKIE elements from $_REQUEST.
  30.  
  31. if(count($_COOKIE)){foreach(array_keys($_COOKIE) as $value){unset($_REQUEST[$value]);}}
  32.  
  33. // Check all fields for an email header.
  34.  
  35. function recursive_array_check_header($element_value)
  36. {
  37.  
  38. global $set;
  39.  
  40. if(!is_array($element_value)){if(preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i",$element_value)){$set = 1;}}
  41. else
  42. {
  43.  
  44. foreach($element_value as $value){if($set){break;} recursive_array_check_header($value);}
  45.  
  46. }
  47.  
  48. }
  49.  
  50. recursive_array_check_header($_REQUEST);
  51.  
  52. if($set){$errors[] = "You cannot send an email header";}
  53.  
  54. unset($set);
  55.  
  56. // Validate email field.
  57.  
  58. if(isset($_REQUEST['email']) && !empty($_REQUEST['email']))
  59. {
  60.  
  61. if(preg_match("/(%0A|%0D|\n+|\r+|:)/i",$_REQUEST['email'])){$errors[] = "Email address may not contain a new line or a colon";}
  62.  
  63. $_REQUEST['email'] = trim($_REQUEST['email']);
  64.  
  65. if(substr_count($_REQUEST['email'],"@") != 1 || stristr($_REQUEST['email']," ")){$errors[] = "Email address is invalid";}else{$exploded_email = explode("@",$_REQUEST['email']);if(empty($exploded_email[0]) || strlen($exploded_email[0]) > 64 || empty($exploded_email[1])){$errors[] = "Email address is invalid";}else{if(substr_count($exploded_email[1],".") == 0){$errors[] = "Email address is invalid";}else{$exploded_domain = explode(".",$exploded_email[1]);if(in_array("",$exploded_domain)){$errors[] = "Email address is invalid";}else{foreach($exploded_domain as $value){if(strlen($value) > 63 || !preg_match('/^[a-z0-9-]+$/i',$value)){$errors[] = "Email address is invalid"; break;}}}}}}
  66.  
  67. }
  68.  
  69. // Check referrer is from same site.
  70.  
  71. if(!(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && stristr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']))){$errors[] = "You must enable referrer logging to use the form";}
  72.  
  73. // Check for a blank form.
  74.  
  75. function recursive_array_check_blank($element_value)
  76. {
  77.  
  78. global $set;
  79.  
  80. if(!is_array($element_value)){if(!empty($element_value)){$set = 1;}}
  81. else
  82. {
  83.  
  84. foreach($element_value as $value){if($set){break;} recursive_array_check_blank($value);}
  85.  
  86. }
  87.  
  88. }
  89.  
  90. recursive_array_check_blank($_REQUEST);
  91.  
  92. if(!$set){$errors[] = "You cannot send a blank form";}
  93.  
  94. unset($set);
  95.  
  96. // Display any errors and exit if errors exist.
  97.  
  98. if(count($errors)){foreach($errors as $value){print "$value<br>";} exit;}
  99.  
  100. if(!defined("PHP_EOL")){define("PHP_EOL", strtoupper(substr(PHP_OS,0,3) == "WIN") ? "\r\n" : "\n");}
  101.  
  102. // Build message.
  103.  
  104. function build_message($request_input){if(!isset($message_output)){$message_output ="";}if(!is_array($request_input)){$message_output = $request_input;}else{foreach($request_input as $key => $value){if(!empty($value)){if(!is_numeric($key)){$message_output .= str_replace("_"," ",ucfirst($key)).": ".build_message($value).PHP_EOL.PHP_EOL;}else{$message_output .= build_message($value).", ";}}}}return rtrim($message_output,", ");}
  105.  
  106. $message = build_message($_REQUEST);
  107.  
  108. $message = $message . PHP_EOL.PHP_EOL."-- ".PHP_EOL."";
  109.  
  110. $message = stripslashes($message);
  111.  
  112. $subject = "FormToEmail Comments";
  113.  
  114. $headers = "From: " . $_REQUEST['email'];
  115.  
  116. mail($my_email,$subject,$message,$headers);
  117.  
  118. ?>
  119.  
  120. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  121.  
  122. <html>
  123.  
  124. <head>
  125. <title>Dreamweaver Tutorial - Contact Form</title>
  126. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  127. </head>
  128.  
  129. <body bgcolor="#ffffff" text="#000000">
  130.  
  131. <div>
  132. <center>
  133. <b>Thank you <?php print stripslashes($_REQUEST['name']); ?></b>
  134. <br>Your message has been sent
  135. <p><a href="<?php print $continue; ?>">Click here to continue</a></p>
  136. <p><b>Dreamweaver Spot</b> by <a href="http://dreamweaverspot.com">dreamweaverspot.com</a></p>
  137. </center>
  138. </div>
  139.  
  140. </body>
  141. </html>
Thanks again,
Don
Oct 16 '09 #1
3 5065
Dormilich
8,658 Recognized Expert Moderator Expert
the only thing I’d suspect would be a Byte Order Mark (some editors place it at the beginning of a file to indicate it’s UTF encoded)
Oct 16 '09 #2
broll911
2 New Member
@Dormilich
Where can I find this Byte Order Mark and removed it?
Oct 16 '09 #3
Atli
5,058 Recognized Expert Expert
Hey.

Try using Notepad++.
Open the file in that and from the "Format" menu select: "Convert to UTF8 without BOM".
Oct 16 '09 #4

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

Similar topics

6
19028
by: Ehartwig | last post by:
I recently created a script for user verification, solved my emailing issues, and then re-created the script in order to work well with the new PHP 5 that I installed on my server. After submitting user information into my creation script, I get the following error from the page that is suppose to insert the user data into the database, create a code, then send an email out for verification. Parse error: parse error, unexpected $end in...
2
1947
by: aamer | last post by:
can anyone please help me, im getting a dumb: Parse error: syntax error, unexpected T_VARIABLE in /home/jeddah/public_html/lomar/cart/remove.php on line 5 in the following file, <?php require_once('../include/top.php');?> <? $urlpara_local="clickmenuid=$clickmenuid&smenuid=$smenuid&pageNum_product_rec=$pageNum_product_rec&totalRows_product_rec=$totalRows_product_rec&totrec=$totrec";...
4
11626
by: bovanshi | last post by:
got this annoying error I'm completly new to php... and i have no clue what is wrong here, from what i can tell there is nothing rong with this code... but that isn't what the borwser say :P Parse error: parse error, unexpected T_VARIABLE in main.php on line 15 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title></title>
5
13172
by: Anna MZ | last post by:
I am new to php and have written the following mysql code to enter the details of a new user in the admin subdomain of my website: $sql = "INSERT INTO 'users' ('userid', 'username', 'upassword') VALUES ('$_POST', '$_POST', '$_POST') mysql_query($sql)"; When I view the code in Internet Explorer I get the following error message: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or...
1
2331
epots9
by: epots9 | last post by:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/html/xxx.php on line xxx I get that message when i try to run my script, but if i disable an if statement (code below) then my code functions correctly... if($specs == "DT") { $angle = $specs; $rating = $specs; if($angle == "00" || $angle == "30")
1
1402
by: mdouble | last post by:
I'm a complete novice with HTML and PHP. Recently I purchased an auto responder that requires me to edit a PHP file during the installation process as per directions provided in a read me file. After editing the required file (globals.php) I am directed to run the installation program on the website by using my browser. However, on doing is I am presented with an error message as follows: Parse error: parse error, unexpected...
3
6947
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the offending line, but being amateur, I don't know where. I've tried putting one in several places, to no avail. Clearly, to solve this in a smaller period than a week I need someone with more skill to help out. Heh heh. The error is: Parse error:...
4
4411
by: needhelp08 | last post by:
I am getting the error Parse error: syntax error, unexpected T_VARIABLE on line 4 but I can't seem to find what is wrong. Could someone please help. <?php $conn = @mysql_connect("localhost", "root", "password ") $rs1 = @mysql_create_db( $_REQUEST ); $rs2 = @mysql_list_dbs( $conn ); for( $row =0; $row < mysql_num_rows( $rs2 ); $row++ ) { $list .= mysql_tablename( $rs2, $row) ." | "; }
5
10032
praclarush
by: praclarush | last post by:
I've just started php, and this is a class assignment, but my question is I’m getting this error PHP Parse error: syntax error, unexpected T_IF, expecting T_VARIABLE or '$' in C:\wamp\www\ssp\SSP04\guessingGame.php on line 42. I’ve tried to make sense of it but I’m at a lose, there error is referring to this segment of the code. else{ if(!isset($_GET)){ echo "<p>****</p>"; $guess = "****"; }//end if //declaring some...
2
3242
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 T_VARIABLE or T_NUM_STRING in /var/www/html/inventoryControl/supplier.php on line 26 (line number changed to match code tags) The code is as follows: // get a supplier using the supplier id
0
9212
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9973
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9779
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9645
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8645
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6473
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5247
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.