Jump to content

[SOLVED] Drop Down Menu Select and Populating Data Fields


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>

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.