Hi:
I am having a problem with PHP and I am new to it, so if you can point out why I am having the error, it would be appreciated.
Error is on line 143 according to the error message, which is:
Parse error: parse error, unexpected $ in /home/paddy/public_html/transcribe.php on line 143
php code is as follows (line 143 is the last line). Note that $LetterContent parts near to the bottom of the code is not completed yet, it will house certain numbers in there.
<?
include("config.php");
$credits = $rows[CreditsLeft];
$connection = mysql_connect("$server", "paddy_transcript", "transcription");
$db = mysql_select_db("paddy_transcription", $connection);
$query = "SELECT * FROM transcribe where username='$username' AND CreditsLeft = '$credits'";
$result = mysql_query($query, $connection);
$CreditsLeft=mysql_numrows($result);
?>
<?
if($SenderFirstName=='' OR $SenderLastName=='' OR $SenderAddress=='' OR $RecipientFirstName=='' OR $RecipientLastName=='' OR $RecipientAddress=='' OR $LetterContent=='' OR $UserName=='')
{
echo "All fields must be completed before you can send this form.";
}
elseif (!eregi("^[A-Za-z]+$", $SenderFirstName)) {
echo "Senders first name field can only contain letters A-Z or a-z with no spaces.";
}
elseif (!eregi("^[A-Za-z]+$", $SenderLastName)) {
echo "Senders last name field can only contain letters A-Z or a-z with no spaces.";
}
elseif (!eregi("^[A-Za-z]+$", $RecipientFirstName)) {
echo "Recipients first name field can only contain letters A-Z or a-z with no spaces.";
}
elseif (!eregi("^[A-Za-z]+$", $RecipientLastName)) {
echo "Recipients last name field can only contain letters A-Z or a-z with no spaces.";
}
elseif (!eregi("^[A-Za-z0-9- ]+$", $SenderAddress)) {
echo "Senders address can only contain letters A-Z or a-z, numbers 0-9, dashes, and spaces.";
}
elseif (!eregi("^[A-Za-z0-9- ]+$", $RecipientAddress)) {
echo "Recipients address can only contain letters A-Z or a-z, numbers 0-9, dashes, and spaces.";
}
else
{
$connection = mysql_connect("$server", "paddy_transcript", "transcription");
$db = mysql_select_db("paddy_transcription", $connection);
$query = "INSERT INTO transcribe (`UserName`,`SenderFirstName`,`SenderLastName`,`SenderAddress`,`RecipientFirstName`,`RecipientLastName`,`RecipientAddress`,`BrailleType`,`LetterContent`,`CreditsPrice`) VALUES ('UserName','$SenderFirstName','$SenderLastName','$SenderAddress','$RecipientFirstName','$RecipientLastName','$RecipientAddress','$BrailleType','$LetterContent','$CreditsPrice')";
$result = mysql_query($query, $connection);
?>
<form action="" method="post">
<table summary="">
<tr>
<td colspan="2">Sender's Information:</td>
</tr>
<tr>
<td><label for="UserName">Braille School Username:</label></td>
<td><input type="text" size="66" name="UserName" id="UserName"></td>
</tr>
<tr>
<td><label for="SenderFirstName">First Name:</label></td>
<td><input type="text" size="66" name="SenderFirstName" id="SenderFirstName"></td>
</tr>
<tr>
<td><label for="SenderLastName">Last Name:</label></td>
<td><input type="text" size="66" name="SenderLastName" id="SenderLastName"></td>
</tr>
<tr>
<td valign="top"><label for="SenderAddress">Address:</label></td>
<td><textarea cols="50" rows="5" name="SenderAddress" id="SenderAddress"></textarea></td>
</tr>
<tr>
<td colspan="2">Recipient's Information:</td>
</tr>
<tr>
<td><label for="RecipientFirstName">First Name:</label></td>
<td><input type="text" size="66" name="RecipientFirstName" id="RecipientFirstName"></td>
</tr>
<tr>
<td><label for="RecipientLastName">Last Name:</label></td>
<td><input type="text" size="66" name="RecipientLastName" id="RecipientLastName"></td>
</tr>
<tr>
<td valign="top"><label for="RecipientAddress">Address:</label></td>
<td><textarea cols="50" rows="5" name="RecipientAddress" id="RecipientAddress"></textarea></td>
</tr>
<tr>
<td><label for="BrailleType">Braille Type:</label></td>
<td><select name='BrailleType" id="BrailleType"><option value="Grade one Braille">Grade one Braille</option><option value="Grade two Braille">Grade two Braille</option></td>
</tr>
<tr>
<td valign="top"><label for="LetterContent">Transcription Text:</label></td>
<td colspan="2"><textarea cols="50" rows="10" name="LetterContent" id="LetterContent"></textarea></td>
</tr>
<tr>
<td><label for="CreditsPrice">Credits Price:</label></td>
<td><input type="text" size="2" readonly name="CreditsPrice" id="CreditsPrice" value="
<? if ($LetterContent == "0") { echo "00"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "01"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "02"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "03"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "04"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "05"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "06"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "07"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "08"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "09"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "10"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "11"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "12"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "13"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "14"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "15"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "16"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "17"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "18"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "19"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "20"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "21"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "22"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "23"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "24"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "25"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "26"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "27"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "28"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "29"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "30"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "31"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "32"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "33"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "34"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "35"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "36"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "37"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "38"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "39"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "40"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "41"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "42"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "43"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "44"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "45"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "46"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "47"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "48"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "49"; } ?>
<? if ($LetterContent == "Azerbaijan") { echo "50"; } ?>"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" <? if ($CreditsLeft == "00") { echo "disabled"; } ?> value="<? if ($CreditsLeft == "00") { echo "Purchase Additional Credits"; } else { echo "Transcribe"; } ?>"></td>
</tr>
</table>
</form>