Jump to content

unexpected T_STRING


adamriley

Recommended Posts

Hi ;)

----------------------------------------------------------------------------------------------------------------

error log "[sat Jan 09 18:27:58 2010] [error] [client 127.0.0.1] PHP Parse error:  syntax error, unexpected T_STRING in C:\\web\\htdocs\\Filey\\2.php on line 8

"

-----------------------------------------------------------------------------------------------------------------

2.php

<?php
$a1 = $_POST["PN"];
$a2 = $_POST["Date_name"];
$a3 = $_POST["Note"];
$filler1 = "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">";
$filler2 = "<html";
$filler2 = "<head>";
$filler3 = "<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">";
$filler4 = "<title>$a1</title>";
$filler5 = "</head>";
$filler6 = "<body bgcolor="#FFFFFF" text="#000000">";
$filler7 = "<div id="bv_Text1" style="position:absolute;left:34px;top:34px;width:713px;height:32px;z-index:0;" align="left">";
$filler8 = "<font style="font-size:27px" color="#000000" face="Arial"><b>Note name:$a1</b></font></div>";
$filler9 = "<div id="bv_Text2" style="position:absolute;left:12px;top:76px;width:781px;height:32px;z-index:1;" align="left">";
$filler10 = "<font style="font-size:27px" color="#000000" face="Arial"><b>Date and time:$a2</b></font></div>";
$filler11 = "<textarea name="TextArea1" id="TextArea1" style="position:absolute;left:41px;top:134px;width:743px;height:391px;font-family:Courier New;font-size:16px;z-index:2" rows="20" cols="70" readonly="readonly">$a3</textarea>";
$filler12 = "</body>";
$filler13 = "</html>";
$myFile = "notenw.html";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "$filler1";
$stringData1 = "$filler2";
$stringData2 = "$filler3";
$stringData3 = "$filler4";
$stringData4 = "$filler5";
$stringData5 = "$filler6";
$stringData6 = "$filler7";
$stringData7 = "$filler8";
$stringData8 = "$filler9";
$stringData9 = "$filler10";
$stringData10 = "$filler11";
$stringData11 = "$filler12";
$stringData12 = "$filler13";
fwrite($fh, "\n");
fwrite($fh, "$stringData1\n");
fwrite($fh, "$stringData2\n");
fwrite($fh, "$stringData3\n");
fwrite($fh, "$stringData4\n");
fwrite($fh, "$stringData5\n");
fwrite($fh, "$stringData6\n");
fwrite($fh, "$stringData7\n");
fwrite($fh, "$stringData8\n");
fwrite($fh, "$stringData9\n");
fwrite($fh, "$stringData10\n");
fwrite($fh, "$stringData11\n");
fwrite($fh, "$stringData12\n");
fclose($fh);
?>

Link to comment
Share on other sites

You should check, it's a simple error!

$filler3 = "<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">";

 

Notice how your quotes aren't escaped? The syntax highlighter shows you as well.

 

If you want to keep them double quotes, wrap your filler text in single quotes like so:

$filler3 = '<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">';

 

And fixed  :P

Link to comment
Share on other sites

i think the fact your using " instead of ' in php code might affect it:

 

you have

$filler3 = "<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">";

 

Should be:

$filler3 = "<meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>";

note: this is the case when using php all the way through your code so line 5 is returning the LAST part as a comment (hence the orange colour after //)

 

 

or you can do what oni-kun said

Link to comment
Share on other sites

i think the fact your using " instead of ' in php code might affect it:

 

You should always use a double quote for HTML attributes.

 

You can either  escape the double quotes or wrap with single quotes.

<?php
$foo = "<link href=\"http://www.google.com\">Google</a>";
$bar = '<link href="http://www.google.com">Google</a>';
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.