Hello, I create one form in a.html file, and once click the "submit" button, it will open add-to-listserv.php and add some info to another file listsev. The code in html is:
<form method="post" action="http://localhost/add-to-listserv.php">
<p>Your Name:
<input type="text" name="Array[Username]" size="50">
</p>
<p>Your Class:
<select name="Array[ClassYear]">
<option value="">Choose One:</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
And the code in add-to-listserv.php is:
<?php
if (($Array[Username]) && ($Array[ClassYear])) {
WriteToFile ($Array[Username], $Array[ClassYear]);
print ("Thank you, $Array[Username]. Your name has now been added to the list.\n");
} else {
print ("Please press the back button on your browser, and enter both your name and class.\n");
}
?>
The problem is whatever I input and choose in the a.html file, the add-to-listserv.php always show the "Please press the back button on your browser, and enter both your name and class." Why the Username and ClassYear can't be obtained by this php file?
Is there anything wrong in these two files?
Thanks a lot!!!