Hello.
Although I have seen someone else having a similar problem here, I got stuck with an error.
This is the code and it shows a red parenthesis.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JumbleMaker</title>
</head>
<body>
<?php
function DisplayError($fieldName, $errorMsg) {
global $errorCount;
echo "Error for\"$fieldName\":$errorMsg<br/>\n";
++$errorCount;
}
functionvalidateWord($data,$fieldName){ <--- THIS IS THE RED PARENTHESIS
global $errorCount;
if (empty($data)){
displayError($fieldName,"Welcome");
$retval="TRUE";
}else{
$retval=trim($data);
$retval=stripslashes($retval);
if((strlen($retval)<4)||(strlen($retval)>7)){
displayError($fieldName,"FALSE");
}
if(preg_match("/^[a-z]+$/i",$retval)==0){
displayError($fieldName,"Words must be letters only");
}
$retval=strtoupper($retval);
$retval=str_shuffle($retval);
return($retval);
}
$word[]=validateword($_POST['word1'], "word1");
$word[]=validateword($_POST['word2'], "word2");
$word[]=validateword($_POST['word3'], "word3");
$word[]=validateword($_POST['word4'], "word4");
if($errorCount>0)
echo "Please use the \"back\" button to re-enter the data.<br/>\n";
else {
$wordnum=0;
foreach ($words as $word)
echo "Word ".++$wordnum.":$word<br />\n";
}
?>
</body>
</html>