In the following code I'M getting a strange output. The browser is displaying a textarea and the actual html code the for the form is inside the text area, it's strange and I can't find the problem.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Pig Latin Generator</title>
</head>
<body>
<h1>Pig Latin Generator</h1>
<?php
if($inputString == NULL)
{
print <<<HERE
<form>
<textarea name = "inputString"
rows = 20
cols = 40</textarea>
<input type = "submit"
value = "pigify">
</form>
HERE;
}
else
{
//there is a value, so we'll deal with it
// break phrase into array
$words = split(" ", $inputString);
foreach($words as $theWord)
{
$theWord = rtrim($theWord);
$firstLetter = subsr($theWorld, 0, 1);
$restOfWord = substr($theWord, 1, strlen($theWord));
//print "$firstLetter) $restOfWord <br> \n";
if(strstr("aeiouAEIOU", $firstLetter))
{
//it's a vowel
$newWord = $theWord . "Way";
}
else
{
//it's a consonant
$newWord = $restOfWord . $firstLetter . "ay";
} // end if
$newPhrase = $newPhrase . $newWord . " ";
} // end foreach
print $newPhrase;
} // end if
?>
</body>
</html>