I am trying to create a repeating form that passes variable and updates the table each time the page is submitted.
for example:
<form action="$_SERVER['PHP_SELF']" method="post">
<p>Student Name: <input type="text" name='studentName[]' size='32'></p>
<button type="submit" name='submit' value='submit'>Submit</button>
</form>
<?php if(isset($_POST['submit']))
{
$studentName[]=$_POST['studentName'];
?>
<table border='1'>
<tr><th>Students Name</th></tr>
<?php
for($x=0; $x < count($studentName); $x++)
{
echo "<tr><td>$studentName[$x]</td></tr>";
} ?>
</table>
}
?>
I know that the above code does not work. What would be the correct way to do something like this? Can someone please write me a correct code that does work. I need to see an example.
I searched all over the internet, but I could not find an example.
I thank you in advance.
Best Regards,
Daniel