adamriley Posted January 11, 2010 Share Posted January 11, 2010 Hi could you say why this script is not working error log ---------------------------------------------------------------------------------------------------------------- [Mon Jan 11 18:08:25 2010] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected T_SL in C:\\web\\htdocs\\Files\\contact.php on line 7, referer: http://localhost/Files/contactform.php -------------------------------------------------------------------------------------------------------------- Form.php ------------------------------------------------------------------------------------------ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Untitled Page</title> <script language="JavaScript" type="text/javascript"> <!-- function ValidateForm1(theForm) { if (theForm.Editbox1.value.length < 4) { alert("It look like you have not deleted the type of reason why your contacting make sure there is a minimum of 4 and a maximum of 5"); theForm.Editbox1.focus(); return false; } if (theForm.Editbox1.value.length > 5) { alert("It look like you have not deleted the type of reason why your contacting make sure there is a minimum of 4 and a maximum of 5"); theForm.Editbox1.focus(); return false; } return true; } //--> </script> </head> <body bgcolor="#FFFFFF" text="#000000"> <div id="bv_Table1" style="position:absolute;left:89px;top:10px;width:600px;height:74px;background-color:#FF0000;z-index:3;" align="left"> <table width="100%" cellpadding="0" cellspacing="1" style="border:5px #0000FF groove;" id="Table1"> <tr> <td align="left" valign="top" bgcolor="#FF0000" width="588" height="62" style="border:1px #0000FF dotted;"> </td> </tr> </table></div> <div id="bv_Text1" style="position:absolute;left:160px;top:31px;width:442px;height:32px;z-index:4;" align="left"> <font style="font-size:27px" color="#000000" face="Arial"><b>Report a bug or your comments</b></font></div> <div id="bv_Table2" style="position:absolute;left:25px;top:88px;width:844px;height:368px;background-color:#FFFF00;z-index:5;" align="left"> <table width="100%" cellpadding="0" cellspacing="1" border="5" bordercolor="#00FF00" id="Table2"> <tr> <td align="left" valign="top" bgcolor="#FFFF00" width="832" height="356" style="border:1px #00FF00 solid;"> </td> </tr> </table></div> <div id="bv_Form1" style="position:absolute;left:30px;top:106px;width:825px;height:326px;z-index:6;" align="left"> <form name="Form1" method="POST" action="contact.php" id="Form1" onsubmit="return ValidateForm1(this)"> <input type="text" id="Editbox1" style="position:absolute;left:11px;top:17px;width:798px;border:5px #0000FF groove;background-color:#FFFF00;color:#FF0000;font-family:Courier New;font-weight:bold;font-style:italic;font-size:24px;z-index:0" name="type" value="Reason for contacting "Error" / "comment" Delete!! 1" maxlength="5" accesskey="1"> <textarea name="Comment" id="TextArea1" style="position:absolute;left:25px;top:62px;width:752px;height:202px;border:6px #0000FF groove;background-color:#FF0000;color:#FFFF00;font-family:Courier New;font-weight:bold;font-style:italic;font-size:16px;z-index:1" rows="9" cols="70">Type any comments or more infomation about the error you found </textarea> <input type="submit" id="Button1" name="Button1" value="Submit" style="position:absolute;left:294px;top:271px;width:199px;height:41px;border:5px #32CD32 inset;background-color:#800080;color:#FF6820;font-family:Arial;font-weight:bold;font-size:27px;z-index:2"> </form> </div> </body> </html> ----------------------------------------------------------- contact.php ------------------------------------------------------- <?php $a1 = $_POST["type"]; $a2 = date("F j, Y, g:i a"); $a3 = $_POST["Comment"]; // Assign all HTML code within one single variable. // All variables within HERDOC will be parsed $stringData = <<<HTMLCODE; $a1|$a2|$a3; HTMLCODE; $myFile = "1221.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, "\n"); fwrite($fh, "$stringData\n"); fclose($fh); ?> Quote Link to comment https://forums.phpfreaks.com/topic/188083-unexpected-t_sl/ Share on other sites More sharing options...
RaythMistwalker Posted January 11, 2010 Share Posted January 11, 2010 PHP isn't expecting the "<<<" at line 7: $stringData = <<<HTMLCODE; Quote Link to comment https://forums.phpfreaks.com/topic/188083-unexpected-t_sl/#findComment-992967 Share on other sites More sharing options...
wildteen88 Posted January 11, 2010 Share Posted January 11, 2010 PHP isn't expecting the "<<<" at line 7: $stringData = <<<HTMLCODE; No adam is using HEREDOC syntax, the <<< is perfectly fine. The problem is the semi-colon ( ; ) at the end of line. Delete the semi-colon and it should fix the error Quote Link to comment https://forums.phpfreaks.com/topic/188083-unexpected-t_sl/#findComment-992971 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.