Jump to content

[SOLVED] Drop Down Menu Select and Populating Data Fields


greenhawk117

Recommended Posts

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>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.