I am trying to create a page that has a form on it that will select a technician and then show his/her schedule in table for on the same page. The problem I am having is that when I click the select button it goes to a blank page. It will not print out the information. I want to have the variable sent to the second php file but I would like the information displayed on the same page instead of going to another page. Could yall please let me know what I am doing wrong?
[EDIT]I should add that I am somewhat new to php and mysql and this is my first project with it other than fooling around at home.
Thanks.
Form code:
<table border="0">
<tr>
<form action="getschedule.php" method="post">
<td><b>Name: </b></td>
<td><select name="name">
<option value="Aaron">Aaron </option>
<option value="Dustin1">Dustin </option>
<option value="Dustin2">Dustin </option>
<option value="Eric">Eric</option>
<option value="Erik">Erik</option>
<option value="Evan">Evan</option>
<option value="Joe">Joe</option>
<option value="Jonathan">Jonathan</option>
<option value="Josh">Josh</option>
<option value="Shay">Shay</option>
</select><br />
</td>
<td><input type="submit" />
</td></form></p>
</tr>
</table>
variable should be sent to this .php code (should do DB search and print table for schedule):
<?php
$day = {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
$y = 0;
$q = $_GET["name"];
$con = mysql_connect('localhost', 'username', 'password');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("schedule", $con);
$sql = "SELECT * FROM technicianschedule WHERE employeename = '".$q."'";
$result = mysql_query($sql);
echo $name . "'s Schedule";
echo "<table border='1'>
<tr>
<th>Day</th>
<th>Date</th>
<th>Location</th>
<th>Start Shift</th>
<th>End Shift</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $day[$y] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "<td>" . $row['Location'] . "</td>";
echo "<td>" . $row['StartTime'] . "</td>";
echo "<td>" . $row['EndTime'] . "</td>";
echo "</tr>";
$y = $y++;
}
echo "</table></div>";
mysql_close($con);
?>