Hi,
I’m having some trouble dynamically generating a form in HTML. I have two pages; the first asks for a number, and the value carries over to the next page where it generates a form based on the input. For example, if you inputted the number 2 on the first page the resulting HTML code on the second page should look like this:
[code]
Please type in a players first name:
Please type in a players first name:
[/code]And here’s the PHP code mixed with HTML to generate the form:
[php]
<form method="post" action="scoregen.php">
<div class="par">
<?php
$curplayer = $_POST['addplayer'];
echo $curplayer;
for ($curplayer; $np++;) {
echo "<p><label for=\"player";
echo $np;
echo"\">Please type in a players first name:</label> <input type=\"text\" id=\"player";
echo $np;
echo "\" name=\"";
echo $np;
echo "\" size=\"17\" maxlength=\"17\" class=\"textbox\" />
</p>";
}
?>
<input type="submit" class="button" value="Start playing!" />
</div>
</form>
[/php]
NOTE: One of the first lines of PHP simply outputs the value submitted by the first page to ensure it’s working.
The problem is that it won’t generate the form. The PHP displaying the value works, but nothing else. You can access the non-working code as is shown here at ripdvd.x10.mx I’m hoping this is just a simple typo as I’m a beginning programmer, but I can’t find it. Anyone have any ideas?
Thanks in advance,
-Max
PS: You get bonus points if you can think of a way to display the symbol ’ that works in every browser!