Im at a loss for how long ive been stuck on this problem. It has been 3 days now and im still struggling.
I have a form which looks up the value of a coursename in a database and the user then fills in the rest of the form.
Then when submit is pressed the formhandler is supposed to update the coursename chosen: Here is a snippet of my form which is the drop down box listing the coursenames.
echo "<option value='".$row['coursecode']."'>".$row['coursename']."</option>\n";
and here is my update code in the formhandler
<?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, $connection)
or die ("Couldn't select database.");
if (isset($_POST['Submit'])) {
//insert the values entered into the courseentry form into the database
$coursename = $POST['coursename'];
$accreditingbody = $POST['accreditingbody'];
$briefdesc = $POST['briefdesc'];
$aimedat = $POST['aimedat'];
$level1 = $POST['level1'];
$level2 = $POST['level2'];
$level3 = $POST['level3'];
$elearning = $POST['elearning'];
$facetoface = $POST['facetoface'];
$blended = $POST['blended'];
$elearningtime = $POST['elearningtime'];
$facetofacetime = $POST['facetofacetime'];
$blendedtime = $_POST['blendedtime'];
$sql = "INSERT INTO trainingtopics (coursename, accreditingbody, briefdesc, aimedat, level1, level2, level3, elearning, facetoface, blendedlearning, elearntime, facetime, blendedtime)
VALUES ('$coursename'
,'$accredtingbody'
,'$briefdesc'
,'$aimedat'
,'$level1'
,'$level2'
,'$level3'
,'$elearning'
,'$facetoface'
,'$blended'
,'$elearningtime'
,'$facetofacetime'
,'$blendedtime'
)"
or die (mysql_error());
//execute query and store the result
$res = mysql_query($sql,$connection);
//check to make sure the query actually ran
if(!$res) {
echo mysql_error().":".mysql_error()."";
return 0;
//$result = $db->query($sql);
echo $sql;
}
}
?>
I get no error messages nor does the db get updated. Please someone spare me this misery. :-)