![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
jamezz98
-
Posts
2 -
Joined
-
Last visited
Posts posted by jamezz98
-
-
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
-
Hi, I am new here and just getting in to PHP setting up my own internal web app with a back end mysql database. Was hoping to get a few tips a some assistance by joining this forum
Regards
James
Issue with variable not updating
in PHP Coding Help
Posted
Thanks for the response daviddannis. I have been playing with it more today and worked out that i had removed the school_id field from my table therefore the insert was not working. Once i had added this in the code works fine.
I left out the " in that string as the value was integer
Cheers