Hi, i've read allot about passing variable but i don't seems to get it work correct. I've used some javascript to show selection from a dropdownbox in a textbox. Then i want to be able to edit text in that box and submit changes back to the mysql database. Anyone suggestion?
Here's my code:
.. some code..
<script language=Javascript>
function passText(passedvalue) {
if (passedvalue != "") {
document.displayform.itemsbox.value = passedvalue;
}
}
</script>
<table border="1"><form name="selectform" Method="Post" Action="salarygrouph.php"><tr>
<td width="90" height="31"><font face="Verdana" size="1">Salary group</font>
<?php
$query = "select * from Lonnsgruppe order by LonnsGID";
$result = mysql_db_query ("roxar", $query);
if ($result){
$numOfRows = mysql_num_rows ($result);
echo "<select valign=\"top\" name=\"LonnsGruppe\" size=1 onClick=\"passText(this.form.LonnsGruppe.options[this.form.LonnsGruppe.selectedIndex].value);\">";
echo "<option value=\" \"></option>";
for ($i = 0; $i < $numOfRows; $i++){
$LonnsGID = mysql_result ($result, $i, "LonnsGID");
$Beskrivelse = mysql_result ($result, $i, "Beskrivelse");
$Beskrivelse = replace_norwegian($Beskrivelse);
echo "<option value=\"$Beskrivelse\"> $LonnsGID</option>";
}
echo "</select>";
}
else{
echo mysql_errno().": ".mysql_error()."<BR>";
}
?>
<td><input type="Submit" value="Add"><input type="reset" value="Reset" name="Nullstill"></td></tr></form>
<form name="displayform" >
<td width="439" height="39" colspan="3"><font face="Verdana" size="1">Description of salary group</font>
<textarea cols="51" rows="5" name="itemsbox" ></textarea>
</form></tr>
</table>
P.S