PHP Code:
<?php

if(isset($_POST['name']) && !empty($_POST['name'])) {
$name htmlentities($_POST['name']);

$handle fopen('names.html''a');
fwrite($handle"<br />".$name);
fclose($handle);
//if

?>

<h4>Add your name to the list!</h3>
<form action="simple.php" method="POST">
Your name:<br />
<input type="text" name="name" /><br />
<input type="submit" value="Add Your Name">
</form>
The script above works fine for adding names to a list in a html page.

I want to change the form action from "simple.php" to "names.html", so that once someone submits the form they are brought to the html page with the list of names. However, when I change the form action to "names.html", the name submitted in the form, is not added to the list of names in the html file. Why is that?

How can I alter the script so that when the form is submitted the name is added to the list and the user is brought to the names.html page.

Thanks!