hello guys, need some help-- building a little site and when i tried to install the coments script onto the page this is the error i get:


Parse error: syntax error, unexpected '<' in /home/shatter/public_html/newtest.php on line 204

now-- i am very inexperienced and trying to loearn how to do this-- but what could be causing this error and do you have somewehre to point me for reference on how to fix it? thanks for the help

newtest.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

  
  <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
  
 
  
  <title>a bit modern</title>
<!-- I linked to the stylesheet using two methods, the @import method as well as the link rel method, to ensure maximum accessibility -->
  <style media="all" type="text/css">
<!--
@import url(styles5.css);
-->
  </style>
  
  <link media="all" href="styles5.css" type="text/css" rel="stylesheet" />
<?php $page_id ="testpage";
include('http://www.shatteredheartspoetry.com/comments_manager/form.php');
include('http://www.shatteredheartspoetry.com/comments_manager/view.php');
?>
</head>
 
 
 
 
<body>

<div id="wrap"><!-- start of container -->
<div id="header">"Torn Between Two"</div>

<div id="content"><!-- left column, contains navigation and photos -->
<div id="column1">
<div id="nav">
<ul>

  <li><a accesskey="o" href="index.html">Home</a></li>

  <li><a accesskey="a" href="about.html">About
Allen</a></li>

  <li><a accesskey="p" href="portfolio.html">Portfolio</a>
  </li>

  <li><a accesskey="h" href="publications.html">Publications</a></li>

  <li><a accesskey="r" href="custom.html">Personalized
Poetry</a></li>

  <li><a accesskey="c" href="comment.html">Guestbook</a></li>

  <li><a accesskey="ff" href="/forum">Forum</a></li>

</ul>

</div>

<img alt="Picture" src="Images/camera1.gif" style="width: 108px; height: 60px;" /> <img alt="Picture" src="Images/camera2test.jpg" style="width: 108px; height: 60px;" />
<img src="Images/bars1.jpg" style="width: 108px; height: 109px;" /></div>

<!-- end of left column --><!-- right column, this is the main content area, and where the links are -->
<div id="column2">
<h1>Torn Between Two</h1>

<p></p>

<div style="text-align: center;">I need you with a clear
mind<br />

to make the right decisions<br />

about your heart and mine.<br />

I know you are caught between two,<br />

but only if you knew<br />

how much I'm in love with you...<br />

<br />

Torn Between Two<br />

<br />

I never pulled your hair, or put you down,<br />

or beat you up, or threw you to the ground;<br />

that's not what real men do<br />

to the love of their life,<br />

I just want you to be my wife...<br />

<br />

Torn Between Two<br />

<br />

Will you give us a chance<br />

or will you rip us apart?<br />

Your torn between two,<br />

one love is real,<br />

and the others may give you the chills...<br />

<br />

Torn Between Two<br />

<br />

I can't make that decision<br />

on who you choose;<br />

but if you like to be abused<br />

and used,<br />

I'm not that dude.<br />

So I will choose for you,<br />

but know I do love you...<br />

<br />

Torn Between Two<br />

<br />

</div>

<h1 style="border-top: medium none; border-right: medium none; border-bottom: medium none; text-align: center;"><a href="sample23.html"><img alt="" src="Images/button2test.jpg" style="border: 0px solid ; width: 165px; height: 23px;" /></a><a href="sample25.html"><img alt="" src="Images/buttonetest.jpg" style="border: 0px solid ; width: 165px; height: 23px;" /></a></h1>

<h1>Comment <!-- Start of Form -->
<div align="center">
<form method="POST" action="post.php?id=<? echo $page_id ?>"
name="myform"&gt;
<table style="border-collapse: collapse;" border="0">

  <tbody>

    <tr>

      <td colspan="2" height="3"><b>Comments:</b>
      
      <hr class="thik" /></td>

    </tr>

    <tr>

      <td>Name:</td>

      <td><input name="name" class="comments_field" maxlength="30" size="35" type="text" /></td>

    </tr>

    <tr>

      <td>Email:</td>

      <td><input class="comments_field" name="email" size="35" type="text" /></td>

    </tr>

    <tr>

      <td colspan="2" height="14">Comments:</td>

    </tr>

    <tr>

      <td colspan="2" height="15"><textarea rows="3" class="comments_field" name="comment" cols="41"></textarea></td>

    </tr>

    <tr>

      <td colspan="2" height="30">
      
      <div align="center"><input value="Post" type="submit" /><input value="Clear" type="reset" /></div>

      </td>

    </tr>

  
  </tbody>
</table>

<!-- End of Form -->
</h1>

<?php include('settings.php');
if ($page_id=="")
{
echo $format_no_id_view;
}
else
{
$fp = fopen( $view_file,"r"); $data = fread($fp, 80000);
fclose( $fp );
$data_array = split ("$spilter", $data);
$total_post = count($data_array) - 1;
$data_format = "$data<b>Total $total_post comments posted here so far.</b>";
if (total_post =="0")
{
echo $no_post;
}
else
{
echo $data_format;
}
}
?></div>

?&gt;s
<p>Future Area for comments on the above poem</p>

<h1>Gallery</h1>

<p>Coming Soon</p>

<ul>

  <li>Coming Soon</li>

  <li>Coming Soon</li>

  <li>Coming Soon</li>

  <li>Coming Soon</li>

  <li>Coming Soon</li>

</ul>

<p>Coming Soon</p>

<h1>Some Links</h1>

<div id="links">
<div>
<ul>

  <li><a href="/forum">Forum</a></li>

  <li><a href="http://www.myspace.com/shatteredheartspoetry">MySpace</a></li>

  <li><a href="http://www.urbandictionary.com">Urban
Dictionary</a></li>

  <li><a href="http://www.shatteredheartspoetry.com">Home</a></li>

</ul>

</div>

<div>
<ul>

  <li><a href="shatteredheartspoetry.blogspot.com">Blog</a></li>

  <li><a href="http://www.digitalgangster.com">DG.com</a></li>

  <li><a href="http://www.shatteredheartspoetry.com">Home</a></li>

  <li><a href="http://www.shatteredheartspoetry.com">Home</a></li>

</ul>

</div>

</div>

</div>

</div>

<!-- end of right column -->
<div id="footer">Original design by <a href="mailto:webmaster@shatteredheartspoetry.com">Trey B</a>.
(c)
2005 shatteredhearts ent llc.</div>

</body>
</html>

i hvae it uploaded at www.shatteredheartspoetry.com/newtest.php
and i got some tutorials to try to learn the basics of php, but this was a script i dl from hotscripts in order to add a comments section on a lil page im trying to develop

Hi,

Not sure what the cause of the error is but there are a few things in your code that caught my eye...

Is there a reason why you're including the files via the web?

include('http://www.shatteredheartspoetry.com/comments_manager/form.php');

This will create a new HTTP connection to the retrieve the page.
It doesn't look very secure also.. if you're executing code received from HTTP, you're never entirely sure if it hasn't been tampered with.

Its also an unnecessary reliance on having php configuration allow remote file inclusion. (dependent on allow_url_fopen)

On line 145, the PHP tags are in shorthand notation.

<? echo $page_id ?>

Its good practice to use:

<?php echo $page_id; ?>

in case you need to move your code to another server that will not read the shorthand notation.

Thanks for posting your code in [ code ] tags. Please tell us, though, where is line 205?

Dani, is there any chance of getting line numbers in the [ code ] sections?

This article has been dead for over six months. Start a new discussion instead.