Hi All,
I have a bit of a tricky PHP/MySQL/JavaScript issue that I hope someone can help me with. I have a dynamically created drop-list (select) as follows:
Code:
<?php
$sql = "SELECT * FROM `$filename` ORDER BY parent_title ASC";
$sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
while ($row = mysql_fetch_assoc($sql_result)) {
if ($row["parent_title"]<>'') {
echo '<option value="';
echo nl2br(stripslashes(utf8_decode($row["parent_code"]))).'">';
echo nl2br(stripslashes(utf8_decode($row["parent_title"]))).'</option>';
};
};
?>
There are two fields here: 'parent_code' and 'parent_title'. What I want to do is have it so that when 'parent_title' is selected (which is what is shown because it is a more user-friendly text entry) it fills in a form field for 'parent_code' AND 'parent_title'. I presume that this is possible using JS, but I confess that I don't know how it can be done. Can anyone give me any pointers?
Thanks,
Neil