Link to home
Start Free TrialLog in
Avatar of blloydd
blloydd

asked on

Parse error: syntax error, unexpected $end in /home/blloyd/public_html/consultation/consult.php on line 209

It seems that the problem is in this bit of code...

the code is written as this...
====================
<TEXTAREA
id="newcustom5"
name="newcustom5"
rows="18"
onchange="validateWords(this, 'inf_newcustom5', 250);"
>
<?php
echo $slcustom5;
?>
</TEXTAREA></TD></TR>
====================
then it is automatically chaned by the Preview, or when I go back into the editor, to this...

=========================
<TEXTAREA id=newcustom5
 name=newcustom5
 rows=18
 onchange="validateWords(this, 'inf_newcustom5', 250);">
&lt;!--npcomments&lt;?php
echo $slcustom5;
?&gt;npcomments--&gt;
</TEXTAREA></TD></TR>
=========================

there must be someting wrong with the original code??

The code is trying to say, display what data is there, or add new data, or edit what is there.  The data is free text limited to 250 words.

Avatar of Harisha M G
Harisha M G
Flag of India image

Hi, are you using HTML Tidy ?

---
Harish
blloydd, the causes for the unexpected $end are:

1) You missed a semicolon (Not necessarily on the stated line, may be anywhere in the whole page)
2) You missed a } (Not necessarily on the stated line, may be anywhere in the whole page)
3) You missed a " (Not necessarily on the stated line, may be anywhere in the whole page)

So, this is one of the worst errors to debug. If you can correct it, fine. Otherwise, post the code of the *full page*.
blloydd,

MGH is correct in what can cause that error.  It may help to find out what you are using as your editor program.  If the editor program is displaying the code as you showed in the second example then it does not seem that it is a real HTML editor program.  If it is changing the code then those changes may be causing the error.

If possible use a basic text editor, like Notepad in Windows, to write the script.  When you save the file make sure that it is not saved with a txt or other extension but with a php extension.  Put the file on your web server using FTP software or by uploading it.  If that file does not have a problem then you should avoid the editor you are using.

Let me know if you have any questions or need more information.


P.S. If you do post the code then don't post the "previewed" version.  It would be useless.

b0lsc0tt
Avatar of blloydd
blloydd

ASKER

if there isa an error it should be in this section...

==============================
<P><IMG height="10" src="/images/spacer.gif" width="2"></P>
<FORM name="sitelokmodify" onsubmit="return validateOnSubmit()" action="preview.php" method="post">
<SCRIPT language="" type="text/javascript">

// Only script specific to this form goes here.
// General-purpose routines are in a separate file.

function validateOnSubmit() {
    var elem;
    var errs=0;
    // execute all element validations in reverse order, so focus gets
    // set to the first one in error.

if (!validateWords(document.forms.sitelokmodify.newcustom5, 'inf_newcustom5', 250)) errs += 1;
  <?php
  if (!$custom3)
    {
    echo "if (!validateButton(document.forms.sitelokmodify.newcustom3, 'inf_newcustom3')) errs += 1;\n";
    }
  ?>
  <?php
  if (!$custom2)
  {
     echo "if (!validateDate(document.forms.sitelokmodify.newcustom2, 'inf_newcustom2')) errs += 1;\n";
  }
  ?>
    if (!validatePresent(document.forms.sitelokmodify.newcustom1, 'inf_newcustom1')) errs += 1;

    if (errs>1)  alert('There are fields which need correction before sending');
    if (errs==1) alert('There is a field which needs correction before sending');

    return (errs==0);
  };
</SCRIPT>
<?php sitelokmodify("",""); ?>
            <TABLE cellSpacing=2 cellPadding=3 align=center border=0>
              <TBODY>
              <TR>
                <TD noWrap align=right width="25%">Name: </TD>
                <TD width="45%">
                <INPUT id="newcustom1" maxLength="50" onchange="validatePresent(this, 'inf_newcustom1');" size="30" value="<?php echo $custom1; ?>" name="newcustom1"></TD>
                <TD class="warn id=inf_newcustom1" width="30%">&nbsp;</TD></TR>
              <TR>
                <TD noWrap align="right">Email: </TD>
                <TD><?php echo $slusername; ?></TD>
                <TD><A href="/consultation/update_email.php">Change email
                  address</A></TD></TR>
              <TR>
                <TD vAlign="top" noWrap align="right">Date of Birth:
                  <BR>(DD/MM/YYYY) </TD>
                <TD vAlign=top>
<?php
  if (!$custom2) {
     echo ("<input name=\"newcustom2\" type=\"text\" id=\"newcustom2\" onChange=\"validateDate(this, 'inf_newcustom2');\" size=\"10\" maxlength=\"10\">");
  }
  else
  {
    echo $custom2;
  }
?> </TD>
              <TD class=warn id=inf_newcustom2>&nbsp;</TD></TR>
              <TR>
              <TD vAlign=top noWrap align=right>Gender:</TD>
              <TD>

<?php
  if (!$custom3)
  {
     echo ("<input type=\"radio\" name=\"newcustom3\" ");
     if (!(strcmp($slcustom3,'Male')))
    {
      echo ("checked");
    }
    echo (" onClick=\"validateButton(this, 'inf_newcustom3');\" value= \"Male\">");
echo ("Male<BR>");


     echo ("<input type=\"radio\" name=\"newcustom3\" ");
     if (!(strcmp($slcustom3,'Female')))
    {
      echo ("checked");
    }
    echo (" onClick=\"validateButton(this, 'inf_newcustom3');\" value= \"Female\">");
echo ("Female<BR>");
?>
</TD>
               

<TD class="warn" id="inf_newcustom3">&nbsp;</TD></TR>
              <TR>
                <TD vAlign="top" noWrap align="right">Enrolment Date: </TD>
                <TD>
<?php
$year=substr($created,0,2);
$month=substr($created,2,2);
$day=substr($created,4,2);
$datecreated=$day."/".$month."/20".$year;
echo $datecreated;
?>
</TD>
                <TD>&nbsp;</TD></TR>
              <TR>
                <TD vAlign="top" noWrap align="right">Last Consultation: </TD>
                <TD>
<?php
echo $custom4;
?></TD>
                <TD>&nbsp;</TD></TR>
              <TR>
                <TD noWrap align="left" colSpan="2">Question (250 words): </TD>
                <TD class="warn" id="inf_newcustom5">&nbsp;</TD></TR>
              <TR>
                <TD noWrap align="middle" colSpan="3">

<TEXTAREA
id="newcustom5"
name="newcustom5"
rows="18"
onchange="validateWords(this, 'inf_newcustom5', 250);"
>
<?php
echo $slcustom5;
?>
</TEXTAREA></TD></TR>
             
<TR align=middle>
<TD colSpan=3><INPUT type="submit" value="Preview and Save" name="Submit"></TD></TR></TBODY></TABLE></FORM>
            <TABLE cellSpacing="2" cellPadding="3" width="100%" border="0">
              <TBODY>
              <TR>
                <TD>&nbsp;</TD>
<TD align=right>
<A href="<?php siteloklogout(); ?>">Exit Without Saving</A>
</TD>

</TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
=====================
Avatar of blloydd

ASKER

tried the suggestion by b0lsc0tt.  Didn't change the error message.  MGH could be right, there is an uneven number of brackets {=9 }=8, but I'm not able to tell which should be there or not.  Full code is above
SOLUTION
Avatar of hiteshgupta1
hiteshgupta1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial