adamriley Posted February 7, 2010 Share Posted February 7, 2010 Hi any one tell me how to make the page work please "im new to php" Error log ----------------------------- [sun Feb 07 16:39:24 2010] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected ';' in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\Brinnington\\Contact\\Display.php on line 9 ------------------------------- Display.php <?php $pfile = fopen("Comments.txt","r"); rewind($pfile); while (!feof($pfile)) { $line = fgets($pfile); $tmp = explode(':', $line); $tmp[0] == $Name { $tmp[1] == $Comment { } } ?> <!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> </head> <body bgcolor="#FFFFFF" text="#000000"> <div id="bv_Text1" style="position:absolute;left:28px;top:22px;width:675px;height:36px;z-index:0;" align="center"> <font style="font-size:32px" color="#000000" face="Arial">Veiw Comments</font></div> <input type="text" id="Editbox1" style="position:absolute;left:238px;top:103px;width:467px;font-family:Courier New;font-size:16px;z-index:1" name="Editbox1" value="<?php echo $name ?>"> <div id="bv_Text2" style="position:absolute;left:27px;top:106px;width:150px;height:27px;z-index:2;" align="left"> <font style="font-size:24px" color="#000000" face="Arial">There Name</font></div> <div id="bv_Text3" style="position:absolute;left:24px;top:158px;width:174px;height:27px;z-index:3;" align="left"> <font style="font-size:24px" color="#000000" face="Arial">There comment</font></div> <textarea name="TextArea1" id="TextArea1" style="position:absolute;left:245px;top:153px;width:449px;height:150px;font-family:Courier New;font-size:16px;z-index:4" rows="7" cols="41"><?php echo $comment ?></textarea> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/191256-unexpected/ Share on other sites More sharing options...
premiso Posted February 7, 2010 Share Posted February 7, 2010 What are you trying to do here: $tmp[0] == $Name { $tmp[1] == $Comment { That really does not make any sense as it is not in an if statement and you randomly add braces after it... Quote Link to comment https://forums.phpfreaks.com/topic/191256-unexpected/#findComment-1008404 Share on other sites More sharing options...
Buddski Posted February 7, 2010 Share Posted February 7, 2010 Not sure what you are trying to achieve here. Perhaps give us a little more info because this. Edit: Pipped at the post (no pun intended) Quote Link to comment https://forums.phpfreaks.com/topic/191256-unexpected/#findComment-1008405 Share on other sites More sharing options...
adamriley Posted February 7, 2010 Author Share Posted February 7, 2010 Ok what im trying to do is get the first bit of information from a text file and then get the second bit of information then display it in the editbox and in the textbox Quote Link to comment https://forums.phpfreaks.com/topic/191256-unexpected/#findComment-1008407 Share on other sites More sharing options...
Buddski Posted February 7, 2010 Share Posted February 7, 2010 <?php $pfile = fopen("Comments.txt","r"); rewind($pfile); while (!feof($pfile)) { $line = fgets($pfile); list($name,$comment) = explode(':', $line); } ?> <!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> </head> <body bgcolor="#FFFFFF" text="#000000"> <div id="bv_Text1" style="position:absolute;left:28px;top:22px;width:675px;height:36px;z-index:0;" align="center"> <font style="font-size:32px" color="#000000" face="Arial">Veiw Comments</font></div> <input type="text" id="Editbox1" style="position:absolute;left:238px;top:103px;width:467px;font-family:Courier New;font-size:16px;z-index:1" name="Editbox1" value="<?php echo $name; ?>"> <div id="bv_Text2" style="position:absolute;left:27px;top:106px;width:150px;height:27px;z-index:2;" align="left"> <font style="font-size:24px" color="#000000" face="Arial">There Name</font></div> <div id="bv_Text3" style="position:absolute;left:24px;top:158px;width:174px;height:27px;z-index:3;" align="left"> <font style="font-size:24px" color="#000000" face="Arial">There comment</font></div> <textarea name="TextArea1" id="TextArea1" style="position:absolute;left:245px;top:153px;width:449px;height:150px;font-family:Courier New;font-size:16px;z-index:4" rows="7" cols="41"><?php echo $comment; ?></textarea> </body> </html> Should do the trick.. Quote Link to comment https://forums.phpfreaks.com/topic/191256-unexpected/#findComment-1008410 Share on other sites More sharing options...
adamriley Posted February 7, 2010 Author Share Posted February 7, 2010 Hi it works is there away to after it has finished putting the name and the comment in the file to go to the next line because the next comment that comes along is on the same line and also is there away to stop a box from apearing at the start and finish of the coment Quote Link to comment https://forums.phpfreaks.com/topic/191256-unexpected/#findComment-1008424 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.