greenhawk117 Posted September 20, 2007 Share Posted September 20, 2007 Hi. I have a PHP/MySQL Content Management System set up for the job I work at. It's basically a shift program that lets users pick up shifts, post shifts, etc. The data fields are tied to the shift ID which is selected from a dynamically populated drop down box. However, I cannot get the data fields to be updated when I select a new value and I cannot get the form to accept the new selected Shift ID. I have tried using JavaScript but cannot quite get it to work. Can someone help? My Code: <table> <form action="<?php echo $editFormAction; ?>" name="takeshift" method="POST"> <tr> <td>Shift ID:</td> <td><select name="shift_id"> <?php do { ?> <option value="<?php echo $row_rs_takeshift['id']?>"><?php echo $row_rs_takeshift['id']?></option> <?php } while ($row_rs_takeshift = mysql_fetch_assoc($rs_takeshift)); $rows = mysql_num_rows($rs_takeshift); if($rows > 0) { mysql_data_seek($rs_takeshift, 0); $row_rs_takeshift = mysql_fetch_assoc($rs_takeshift); } ?> </select></td> </tr> <tr> <td>Taken by:</td> <td><input value="<?php echo $row_rs_user['ubitname']; ?>" type="text" name="taken_by" readonly="yes" /></td> </tr> <tr> <td>Shift Date:</td> <td><input value="<?php echo $row_rs_takeshift['date']; ?>" type="text" name="shiftdate" readonly="yes" /></td> </tr> <tr> <td>Shift Begins:</td> <td><input value="<?php echo $row_rs_takeshift['time_begin']; ?>" type="text" name="time_begin" readonly="yes" /></td> </tr> <tr> <td>Shift Ends:</td> <td><input value="<?php echo $row_rs_takeshift['time_end']; ?>" type="text" name="time_end" readonly="yes" /></td> </tr> <tr> <td><input type="submit" value="Take Shift" /></td> </tr> <input type="hidden" name="status" value="Taken" /> <input type="hidden" name="MM_update" value="takeshift"> </form> </table> Link to comment https://forums.phpfreaks.com/topic/70021-solved-drop-down-menu-select-and-populating-data-fields/ Share on other sites More sharing options...
greenhawk117 Posted September 25, 2007 Author Share Posted September 25, 2007 I solved the problem by linking to another page and pulling the id through as a URL parameter. Link to comment https://forums.phpfreaks.com/topic/70021-solved-drop-down-menu-select-and-populating-data-fields/#findComment-354614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.