This is a problem that is really bugging me. I have dropdown box which shows a list of coursenames in a table but when I select a coursename from the dropdown box the fields relating to that course are supposed to show in the form as well without redirecting to another form so the fields can be updated. Here is a snippet- what on earth am I doing wrong!
<?php
$user = "root";
$host = "localhost";
$password = "";
$connection = mysql_connect($host, $root, $password) or die ("Couldn't connect to server.");
$database = "courses";
$db = mysql_select_db($database) or die ("Couldn't select database.");
$sql = "SELECT coursename FROM trainingtopics";
$result = mysql_query($sql) or die(mysql_error());
echo $result."=result<br>";
while($row=mysql_fetch_array($result))
{
echo "<option value='".$row['coursecode']."'>".$row['coursename']."</option>\n";
}
?>
</select>
//when coursename selected above show what has been entered previously for all the fields below and allows the user to update it
<br>
<br>
<input name="accreditingbody" type="text" value="$accreditingbody['accreditingbody']." size="50">
<br>
<textarea name="briefdesc" cols="75" id="briefdesc"></textarea>
<br>
<br>
<textarea name="aimedat" cols="75" id="aimedat"></textarea>
<br>
<br>
<select name="level1" size="1" id="level1">
<option>Yes</option>
<option>No</option>
<option>Not selected</option>
</select>
<br>
<br>
<select name="level2" size="1" id="level2">
<option>Yes</option>
<option>No</option>
<option>Not selected</option>
</select>
<br>
<br>
<select name="level3" size="1" id="select2">
<option>Yes</option>
<option>No</option>
<option>Not selected</option>
</select>
<br>
<br>
<select name="elearning" size="1" id="select3">
<option>Yes</option>
<option>No</option>
<option>Not selected</option>
</select>
<br>
<br>
<select name="facetoface" size="1" id="select4">
<option>Yes</option>
<option>No</option>
<option>Not selected</option>
</select>
<br>
<br>
<select name="blended" size="1" id="select5">
<option>Yes</option>
<option>No</option>
<option>Not selected</option>
</select>
<br>
<br>
<input name="elearningtime" type="text" id="elearningtime" value="" size="50">
<br>
<br>
<input name="facetofacetime" type="text" id="facetofacetime" value="" size="50">
<br>
<br>
<input name="blendedtime" type="text" id="elearningtime" value="" size="50">
<br>
<br>
<input type="submit" name="Submit" value="Update">
<input type="reset" name="reset" value="Reset">
</form>