Hey, you guys. How is everybody doing? Happy 2012!
So, I’ve been trying for a week now to create code to write some user input to certain files using a loop. Now, this should be a very straight-forward program to make, but I’ve never used PHP before and a text-editor is all that is available to me (I know), so I’m sorry if this ends up being solved in ten seconds. Anyway, the following does not work. Why does it not?
[php]$n = 1; //index that goes through the switch cases one at a time.
while ($n < 13)
{
switch ($n)
{
case 1:
if (strlen($best1) && strlen ($worst1) && !strpos($best1, " ") && !strpos($worst1, " ") { // make sure a one-worded entry was entered
$txtFile = $n . “.html”; //save text to n.html, here 1.html.
$text= $best1 . “
” . $worst1 . "
" . $pn . “”; //take user input
$fh = fopen($txtFile, ‘a+’);
fwrite($fh, $text);
fclose($fh);}
else
{
// Hey, NAME! Please fill in all textboxes with one-worded entries.
$msagbox = “Hey,” . $pn . “! Please fill in all textboxes with one-worded entries.”
echo “”;
}
break;
default:
break;
}
n++;}[/php]
Any help would be greatly appreciated. Thanks, guys!