This is what I am looking to do:
I have a drop down list that has two values, one is Grade one Braille, the other is Grade two Braille.
If Grade one Braille is selected, then you can only have 1000 characters maximum in the form field called LetterContent. If Grade two Braille is selected, then you can have 2000 characters maximum. However, I get an error, so it seems I have not coded it correctly. Can you please review my code and tell me where I am going wrong?
Thanks in advance.
error
Parse error: parse error, unexpected '{' in /home/paddy/public_html/processtranscribe.php on line 27
line 27 is:
(strlen($LetterContent) > 1000) {
the code for the page is:
<?
//// ALL FIELDS MUST CONTAIN SOMETHING
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.";
}
//// IF THE FORM FIELD LABELED BrailleType IS EQUAL TO GRADE ONE BRAILLE
//// THEN THE FORM FIELD LABELED LetterContent CAN ONLY HAVE 1000 CHARACTERS MAXIMUM
elseif($BrailleType=='Grade one Braille')
{
(strlen($LetterContent) > 1000) {
echo "One page of transcribed grade one Braille is equal to a maximum of 1000 characters, including spaces.";
}
}
//// IF THE FORM FIELD LABELED BrailleType IS EQUAL TO GRADE TWO BRAILLE
//// THEN THE FORM FIELD LABELED LetterContent CAN ONLY HAVE 2000 CHARACTERS MAXIMUM
elseif($BrailleType=='Grade two Braille')
{
(strlen($LetterContent) > 2000) {
echo "One page of transcribed grade two Braille is equal to a maximum of 2000 characters, including spaces.";
}
}
else
{
include("config.php");
$connection = mysql_connect("$server", "paddy_transcript", "transcription");
$db = mysql_select_db("paddy_transcription", $connection);
$query = "INSERT INTO $transcribe_tbl (`UserName`,`SenderFirstName`,`SenderLastName`,`SenderAddress`,`RecipientFirstName`,`RecipientLastName`,`RecipientAddress`,`BrailleType`,`LetterContent`) VALUES ('$UserName','$SenderFirstName','$SenderLastName','$SenderAddress','$RecipientFirstName','$RecipientLastName','$RecipientAddress','$BrailleType','$LetterContent')";
$result = mysql_query($query, $connection);
echo "<H1>Confirmation!</H1>Hi $SenderFirstName $SenderLastName,<br><br>Thank you for giving us the opportunity to transcribe a letter for you. We will send the letter free matter for the blind to $RecipientFirstName $RecipientLastName as soon as the letter is transcribed into $BrailleType.<br><br>Cordially,<br> Braille School Transcription Service.<br><a href=\"mailto:transcription@brailleschool.com\">transcription@brailleschool.com</a><hr>";
}
?>