I received assistance from this forum just yesterday and so I thought I would try here again. This is my code for the php file that is supposed to receive data from an external html file and manipulate it but it is not receiving anything and I do not see why.
<!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">
<title>Word Jumble</title>
<body>
<?php
error_reporting(E_ALL & ~E_NOTICE);
function DisplayError($fieldName, $errorMsg) {
echo "Error for \ "$fieldName\": $errorMsg<br \>\n";
++$errorCount; }
function wordCheck($data, $fieldName) {
global $errorCount;
if (empty($data)) {
displayError($fieldName, "You must enter a word here between 4 and 7 chracters");
$retval = "";
else {
$retval = trim($data);
$retval = striplashes($retval);
if ((strlen(($retval)<4))|| (strlen($retval)>7)) {
displayError($fieldName, Must be between 4 ans 7 characters in length"); }
if (preg_match("/^[a-z]+$/i", $retval)==0){
displayError($fieldName, Words must be letters only");
}
}
$retval = strtoupper($retval);
$retval = str_shuffle($retval);
return($retval);
}
$words[] = wordCheck($_POST["word 1"], "word 1");
$words[] = wordCheck($_POST["word 2"], "word 2");
$words[] = wordCheck($_POST["word 3"], "word 3");
$words[] = wordCheck($_POST["word 4"], "word 4");
if ($errorCount>0)
echo "Please re-enter data.<br />\n";
else {
$wordnum = 0;
foreach ($words as $Word)
echo "Word ", ++$wordnum.": $Word<br />\n";
}
?>
</body>
</html>
This is the code from the html file that is supposed to collect inputted data from the user and send it to the php file above but is not working correctly.
<!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>Words for Jumble</title>
</head>
<body>
<?php
<h3>Please enter 4 words between 4 and 7 characters long</h3>
<p>word 1: <input type="text" name="word 1"></p>
<p>word 2: <input type="text" name="word 2"></p>
<p>word 3: <input type="text" name="word 3"</p>
<p>word 4: <input type="text" name="word 4"</p>
$word 1 = word 1
$word 2 = word 2
$word 3 = word 3
$word 4 = word 4
<input type="reset" value="Clear Form" />
<input type="submit" name="submit" value="send form" />
echo $word 1
echo $word 2
echo $word 3
echo $word 4
?>
</body>
</html>
If you can see what is wrong please tell me!!
Thanks!!:)