Hi all,
I am writing a simple time tracking web app in php with a backend mysql database to run on my NAS at home. When entering time in to the timesheet i have a drop down for school then a drop down to location. Once these are selected you select the date and enter the hours and click the submit button to add your time. It does not seem to be passing the school ID correctly. Here is the section from my main time entry page which select the school names from the School table and puts the id from the table in $school.
<td>
<select id='schoolid' name="school">
<option value="">-- Select School --</option>
<?php
// Get records from database Locations
$list=mysql_query("select * from School order by school_name asc");
// Show records by while loop in the drop down box.
while($row2=mysql_fetch_assoc($list)){
?>
<option value=<? echo $row2['id']; ?>><? echo $row2['school_name']; ?></option>
<?php $school = $row2['id']; ?>
<?php } ?>
</select>
</td>
I have two hidden fields which store this information to pass to the post page. I have even changed them from hidden to text as you can see below to see what they are being set to. When i change school in the dropdown to another school it does not seem to change the id passed.
</table>
Mileage <input type="text" name="mileage" value=<?php echo $mileage_id; ?> />
SchoolID <input type="text" name="school" value=<?php echo $school; ?> />
<input type="submit" name="submit" value="Add Time" />
</form>
Is this enough information to see what i am doing wrong?
Thanks in advance
Regards
James