I am trying to practice my php form interaction and I ran into a little snag. This code works fine when I take out the month and the day selections however when I leave them in I get a 404 Page Not Found Error.
<?PHP
if ($_POST['Submit']){ // if the form was submitted
echo $_POST['homeTeam'];
echo $_POST['awayTeam'];
echo $_POST['matchDate'] . ' ';
echo $_POST['month'] . ' ';
echo $_POST['day'] . ', ';
echo $_POST['year'];
}
else { //if the form hasn't been submitted yet
?>
<form action="" method="post" id="addMatch">
<label id="homeTeam">Home: <input type="text" name="homeTeam" /></label>
<label id="awayTeam">Away: <input type="text" name="awayTeam" /></label>
<label id="month">Month:
<select name="month">
<?php foreach(range(1,12) as $month){
echo '<option value="' . $month . '">' . date("F",strtotime("0000-$month")) . '</option>';
}
?>
</select></label>
<label id="day">Day:
<select name="day">
<?php foreach(range(1,31) as $day){
echo '<option value="' . $day . '">' . $day . '</option>';
}
?>
</select></label>
<input type="hidden" name="year" value="2014" />
<input type="submit" name="Submit" />
</form>
<?php
}
?>
I've tried rewriting the code a couple of different ways and always the same result.