PDA

View Full Version : Dynamic textarea from drop down menu



Humper
10-14-2008, 06:01 PM
I am creating a form that needs to be dynamic. I need to be able to select a Delivery Order number from the list and input Highlights into the text box. I need to be able to select more then one Delivery Order.

So basically I need to select a Delivery Order from the list then write some data... then pick a new Delivery Order and write some data... I need it to be able to save the data until you click submit... Is there a way to do this? I have been looking online for a few days now but cant find anything (I may not be looking for the correct things).




<form name="WDR" action="WDR_add.php" method="post">
<table>
<tr>
<td colspan="6">
<strong>Select Delivery Order:</strong><br />
<select name="DO">
<option value="#" selected="selected">Select Delivery Order</option>
<?php
$query = "SELECT DONum, TaskName FROM DeliveryOrders ORDER BY TaskName";
$result = mysql_query($query);

while($row= mysql_fetch_array($result))
{
$DONum = $row["DONum"];
$TaskName = $row["TaskName"];
$DO = $DONum . " " . $TaskName;
print "<option value=\"$DONum\" > $DO </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="6">
<strong>Reporting Period Highlights:</strong><br />
<textarea name="Highlights" cols="50" rows="9" id="Highlights"></textarea>
</td>
</tr>
<tr>
<td><input name="Submit" type="submit" value="Submit WDR" /> </td>
<td colspan="2">&nbsp;</td>
</tr>

</table>
</form>

maneetpuri
10-16-2008, 11:25 AM
Hi,

Change the line: - <select name="DO">
To: - <select name="DO" multiple>

Now you will be able to select multiple value from the drop down by holding the ctrl button.

Now when you will submit the button you will get DO as an array with all the selected values.

Hope this solves the purpose.

Cheers,

~Maneet
LeXolution IT Services
Web Development Services (http://www.lexolutionit.com)

Humper
10-16-2008, 12:44 PM
I am able to select multiple ones from the drop down but what I really need is to be able to select ONE Delivery Order at a time and have a new textarea be created for each one that I select.....

so say there is one textarea... I need for that textarea to clear everytime they pick a new Delivery Order.... but it also needs to save the text that was typed in the textarea for that Delivery Orders..

Sorry its hard to explain