brax23 Posted August 8, 2008 Share Posted August 8, 2008 After searching the html posts I'm not quite sure where to post this question. So I'll first ask "where should I post this question"? I'm using php and html. I'd like to produce a page used for entering time worked on a project. This is a timesheet page. I'd like to make a drop down menu that's list is populated from a mysql database table containing project numbers. A text box on the same page would allow me to enter a time value in hours. Once the project number is selected and the time value is entered into the text box I'd like to select a "submit" button which would take me to another page. The script on the other page would allow me to use the values from the previous page to update my database so I would need to pass both the drop down value selected (project number) and the value entered in the text box (time value) to the next page. Can anyone offer any suggestions or perhaps provide guidance on where to search for guidance? Quote Link to comment https://forums.phpfreaks.com/topic/118774-drop-down-linked-to-datbase-table/ Share on other sites More sharing options...
adam84 Posted August 8, 2008 Share Posted August 8, 2008 This is how to create a drop down box using results from your database $results = mysql_query( "SELECT pID, pName FROM whereEver ORDER BY id" ); echo "<SELECT ID=project>"; while( $row = mysql_fetch_array( $results ) ){ echo "<OPTION VALUE='" . $row['pID'] . "'>" . $row['pName']; } echo "</SELECT>"; Quote Link to comment https://forums.phpfreaks.com/topic/118774-drop-down-linked-to-datbase-table/#findComment-611807 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.