I get the following error when I run the script:

Parse error: syntax error, unexpected '{' in /home/rjbind/public_html/cert/score.php on line 61

Here is the script syntax:

<p align="center">
<a href="http://serverpg.com/clients/">
<img border="0" src="http://www.rjbind.com/cert/header.jpg"></a></p>



<?php


/*


ServerPG Certification v1.1


Copyright (c) 2006 serverPG.com


This is not intended for redistribution
Do not remove any Copyright notice unless you have made arrangements with ServerPG


If you have any questions or comments, please email:


Supportinfo@serverpg.comhttp://serverpg.com/clients/


http://www.serverpg.com


*/


//create short variable names
$q1 = $_POST;
$q2 = $_POST;
$q3 = $_POST;
$q4 = $_POST;
$q5 = $_POST;
$q6 = $_POST;
$q7 = $_POST;
$q8 = $_POST;
$q9 = $_POST;
$q10 = $_POST;
$q11 = $_POST;
$q12 = $_POST;
$q13 = $_POST;
$q14 = $_POST;
$q15 = $_POST;
$q16 = $_POST;
$q17 = $_POST;
$q18 = $_POST;
$q19 = $_POST;
$q20 = $_POST;
$q21 = $_POST;
$q22 = $_POST;
$q23 = $_POST;
$q24 = $_POST;
$q24 = $_POST;


$name = $_POST;


// check that all the data was received
if($q1==''||$q2==''||$q3==''||$q4==''||$q5==''||$q6==''||$q7==''||
$q8==''||$q9==''||$q10==''||$q11==''||$q12==''||$q13==''||
$q14==''||$q15==''||$q16==''||$q17==''||$q18==''||$q19==''||
$q20==''||$q21==''||$q22==''||$q23==''||$q24==''||#25==''||$name==''}
{
echo '<h1><p align = "center"><img src="rosette.gif" alt="">
Sorry:
<img src="rosette.gif" alt=""></p></h1>';
echo '<p>You need to fill in your name and answer all questions</p>';
}
else
{
//add up the scores
$score = 0;
if($q1 == 1) // the correct answer for q1 is 1
$score++;
if($q2 == 1) // the correct answer for q2 is 1
$score++;
if($q3 == 1) // the correct answer for q3 is 1
$score++;
if($q4 == 1) // the correct answer for q4 is 1
$score++;
if($q5 == 1) // the correct answer for q5 is 1
$score++;
if($q6 == 1) // the correct answer for q6 is 1
$score++;
if($q7 == 1) // the correct answer for q7 is 1
$score++;
if($q8 == 1) // the correct answer for q8 is 1
$score++;
if($q9 == 1) // the correct answer for q9 is 1
$score++;
if($q10 == 1) // the correct answer for q10 is 1
$score++;
if($q11 == 1) // the correct answer for q11 is 1
$score++;
if($q12 == 1) // the correct answer for q12 is 1
$score++;
if($q13 == 1) // the correct answer for q13 is 1
$score++;
if($q14 == 1) // the correct answer for q14 is 1
$score++;
if($q15 == 1) // the correct answer for q15 is 1
$score++;
if($q16 == 1) // the correct answer for q16 is 1
$score++;
if($q17 == 1) // the correct answer for q17 is 1
$score++;
if($q18 == 1) // the correct answer for q18 is 1
$score++;
if($q19 == 1) // the correct answer for q19 is 1
$score++;
if($q20 == 1) // the correct answer for q20 is 1
$score++;
if($q21 == 1) // the correct answer for q21 is 1
$score++;
if($q22 == 1) // the correct answer for q22 is 1
$score++;
if($q23 == 1) // the correct answer for q23 is 1
$score++;
if($q24 == 1) // the correct answer for q24 is 1
$score++;
if($q25 == 1) // the correct answer for q25 is 1
$score++;


//convert score to a percentage
$score = $score / 25 * 100;


if($score < 80)
{
// this person failed
echo '<h1 align="center"><img src="rosette.gif" alt="" />
Sorry:
<img src="rosette.gif" alt="" /></h1>';
echo '<p>You need to score at least 80% to pass the exam</p>';
}
else
{
// create a string containing the score to one decimal place
$score = number_format($score, 0);


echo '<h1 align="center"><img src="rosette.gif" alt="" />
Congratulations
<img src="rosette.gif" alt="" /></h1>';
echo "<p>Well done $name, with a score of $score%,
you have passed the exam.</p>";


// provide links to scripts that generate the certificates
echo '<p>Please click here to download your certificate as
a Microsoft Word (RTF) file.</p>';
echo '<form action="rtf.php" method="post">';
echo '<center>
<input type="image" src="certificate.gif" border="0">
</center>';
echo '<input type="hidden" name="score" value="'.$score.'">';
echo '<input type="hidden" name="name" value="'.$name.'">';
echo '</form>';


}
}
?>

Please help. Thanks so much in advance!!

what is line 61?

nevermind i found the error. on the if statement of "check that all data was recieved", you put a "}" instead of a ")".

I corrected the } to ) and still get the same error

try this, it should work:

<?php

/*

ServerPG Certification v1.1

Copyright (c) 2006 serverPG.com

This is not intended for redistribution
Do not remove any Copyright notice unless you have made arrangements with ServerPG

If you have any questions or comments, please email:

Support
info@serverpg.com
http://serverpg.com/clients/

http://www.serverpg.com

*/ 

//create short variable names
$q1 = $_POST['q1'];
$q2 = $_POST['q2'];
$q3 = $_POST['q3'];
$q4 = $_POST['q4'];
$q5 = $_POST['q5'];
$q6 = $_POST['q6'];
$q7 = $_POST['q7'];
$q8 = $_POST['q8'];
$q9 = $_POST['q9'];
$q10 = $_POST['q10'];
$q11 = $_POST['q11'];
$q12 = $_POST['q12'];
$q13 = $_POST['q13'];
$q14 = $_POST['q14'];
$q15 = $_POST['q15'];
$q16 = $_POST['q16'];
$q17 = $_POST['q17'];
$q18 = $_POST['q18'];
$q19 = $_POST['q19'];
$q20 = $_POST['q20'];
$q21 = $_POST['q21'];
$q22 = $_POST['q22'];
$q23 = $_POST['q23'];
$q24 = $_POST['q24'];
$q25 = $_POST['q25'];

$name = $_POST['name'];

// check that all the data was received
if($q1==''||$q2==''||$q3==''||$q4==''||$q5==''||$q6==''||$q7==''||
$q8==''||$q9==''||$q10==''||$q11==''||$q12==''||$q13==''||
$q14==''||$q15==''||$q16==''||$q17==''||$q18==''||$q19==''||
$q20==''||$q21==''||$q22==''||$q23==''||$q24==''||$q25==''||$name=='')
{
echo '<h1><p align = "center"><img src="rosette.gif" alt="">
Sorry:
<img src="rosette.gif" alt=""></p></h1>';
echo '<p>You need to fill in your name and answer all questions</p>';
}
else
{
//add up the scores
$score = 0; 
if($q1 == 1) // the correct answer for q1 is 1
$score++;
if($q2 == 1) // the correct answer for q2 is 1
$score++;
if($q3 == 1) // the correct answer for q3 is 1
$score++;
if($q4 == 1) // the correct answer for q4 is 1
$score++;
if($q5 == 1) // the correct answer for q5 is 1
$score++;
if($q6 == 1) // the correct answer for q6 is 1
$score++;
if($q7 == 1) // the correct answer for q7 is 1
$score++;
if($q8 == 1) // the correct answer for q8 is 1
$score++;
if($q9 == 1) // the correct answer for q9 is 1
$score++;
if($q10 == 1) // the correct answer for q10 is 1
$score++;
if($q11 == 1) // the correct answer for q11 is 1
$score++;
if($q12 == 1) // the correct answer for q12 is 1
$score++;
if($q13 == 1) // the correct answer for q13 is 1
$score++;
if($q14 == 1) // the correct answer for q14 is 1
$score++;
if($q15 == 1) // the correct answer for q15 is 1
$score++;
if($q16 == 1) // the correct answer for q16 is 1
$score++;
if($q17 == 1) // the correct answer for q17 is 1
$score++;
if($q18 == 1) // the correct answer for q18 is 1
$score++;
if($q19 == 1) // the correct answer for q19 is 1
$score++;
if($q20 == 1) // the correct answer for q20 is 1
$score++;
if($q21 == 1) // the correct answer for q21 is 1
$score++;
if($q22 == 1) // the correct answer for q22 is 1
$score++;
if($q23 == 1) // the correct answer for q23 is 1
$score++;
if($q24 == 1) // the correct answer for q24 is 1
$score++;
if($q25 == 1) // the correct answer for q25 is 1
$score++;

//convert score to a percentage
$score = $score / 25 * 100;

if($score < 80)
{
// this person failed
echo '<h1 align="center"><img src="rosette.gif" alt="" />
Sorry:
<img src="rosette.gif" alt="" /></h1>';
echo '<p>You need to score at least 80% to pass the exam</p>';
} 
else
{
// create a string containing the score to one decimal place
$score = number_format($score, 0);

echo '<h1 align="center"><img src="rosette.gif" alt="" />
Congratulations
<img src="rosette.gif" alt="" /></h1>';
echo "<p>Well done $name, with a score of $score%, 
you have passed the exam.</p>";

// provide links to scripts that generate the certificates
echo '<p>Please click here to download your certificate as 
a Microsoft Word (RTF) file.</p>';
echo '<form action="rtf.php" method="post">';
echo '<center>
<input type="image" src="certificate.gif" border="0">
</center>';
echo '<input type="hidden" name="score" value="'.$score.'">';
echo '<input type="hidden" name="name" value="'.$name.'">';
echo '</form>';

}
}
?>

Thanks for all your help. It worked great!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.