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(th is, '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(th is, 'inf_newcustom5', 250);">
<!--npcomments<?php
echo $slcustom5;
?>npcomments-->
</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.
the code is written as this...
====================
<TEXTAREA
id="newcustom5"
name="newcustom5"
rows="18"
onchange="validateWords(th
>
<?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(th
<!--npcomments<?php
echo $slcustom5;
?>npcomments-->
</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.
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*.
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
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
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.f orms.sitel okmodify.n ewcustom5, 'inf_newcustom5', 250)) errs += 1;
<?php
if (!$custom3)
{
echo "if (!validateButton(document. forms.site lokmodify. newcustom3 , 'inf_newcustom3')) errs += 1;\n";
}
?>
<?php
if (!$custom2)
{
echo "if (!validateDate(document.fo rms.sitelo kmodify.ne wcustom2, 'inf_newcustom2')) errs += 1;\n";
}
?>
if (!validatePresent(document .forms.sit elokmodify .newcustom 1, '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%"> </TD></T R>
<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(th is, 'inf_newcustom2');\" size=\"10\" maxlength=\"10\">");
}
else
{
echo $custom2;
}
?> </TD>
<TD class=warn id=inf_newcustom2> </ 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(t his, 'inf_newcustom3');\" value= \"Male\">");
echo ("Male<BR>");
echo ("<input type=\"radio\" name=\"newcustom3\" ");
if (!(strcmp($slcustom3,'Fema le')))
{
echo ("checked");
}
echo (" onClick=\"validateButton(t his, 'inf_newcustom3');\" value= \"Female\">");
echo ("Female<BR>");
?>
</TD>
<TD class="warn" id="inf_newcustom3"> </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."/".$mon th."/20".$ year;
echo $datecreated;
?>
</TD>
<TD> </TD></TR>
<TR>
<TD vAlign="top" noWrap align="right">Last Consultation: </TD>
<TD>
<?php
echo $custom4;
?></TD>
<TD> </TD></TR>
<TR>
<TD noWrap align="left" colSpan="2">Question (250 words): </TD>
<TD class="warn" id="inf_newcustom5"> </TD></TR>
<TR>
<TD noWrap align="middle" colSpan="3">
<TEXTAREA
id="newcustom5"
name="newcustom5"
rows="18"
onchange="validateWords(th is, '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></TA BLE></FORM >
<TABLE cellSpacing="2" cellPadding="3" width="100%" border="0">
<TBODY>
<TR>
<TD> </TD>
<TD align=right>
<A href="<?php siteloklogout(); ?>">Exit Without Saving</A>
</TD>
</TR></TBODY></TABLE></TD> </TR></TBO DY></TABLE ></TD></TR ></TBODY>< /TABLE>
=====================
==========================
<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.f
<?php
if (!$custom3)
{
echo "if (!validateButton(document.
}
?>
<?php
if (!$custom2)
{
echo "if (!validateDate(document.fo
}
?>
if (!validatePresent(document
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(
<TD class="warn id=inf_newcustom1" width="30%"> </TD></T
<TR>
<TD noWrap align="right">Email: </TD>
<TD><?php echo $slusername; ?></TD>
<TD><A href="/consultation/update
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(th
}
else
{
echo $custom2;
}
?> </TD>
<TD class=warn id=inf_newcustom2> </
<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(t
echo ("Male<BR>");
echo ("<input type=\"radio\" name=\"newcustom3\" ");
if (!(strcmp($slcustom3,'Fema
{
echo ("checked");
}
echo (" onClick=\"validateButton(t
echo ("Female<BR>");
?>
</TD>
<TD class="warn" id="inf_newcustom3">
<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."/".$mon
echo $datecreated;
?>
</TD>
<TD> </TD></TR>
<TR>
<TD vAlign="top" noWrap align="right">Last Consultation: </TD>
<TD>
<?php
echo $custom4;
?></TD>
<TD> </TD></TR>
<TR>
<TD noWrap align="left" colSpan="2">Question (250 words): </TD>
<TD class="warn" id="inf_newcustom5">
<TR>
<TD noWrap align="middle" colSpan="3">
<TEXTAREA
id="newcustom5"
name="newcustom5"
rows="18"
onchange="validateWords(th
>
<?php
echo $slcustom5;
?>
</TEXTAREA></TD></TR>
<TR align=middle>
<TD colSpan=3><INPUT type="submit" value="Preview and Save" name="Submit"></TD></TR></
<TABLE cellSpacing="2" cellPadding="3" width="100%" border="0">
<TBODY>
<TR>
<TD> </TD>
<TD align=right>
<A href="<?php siteloklogout(); ?>">Exit Without Saving</A>
</TD>
</TR></TBODY></TABLE></TD>
=====================
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
---
Harish