Hi,
I am very new to programming and especially PHP. I am trying to make a selction from the drop down list to insert into MySQL database. I managed to populate the drop down list from the database, but when i make a selection to insert it, nothing happens. I don't even get the error message. Can someone please review my code. I really need some help.
thanks in advance!
<html>
<head>
<title>FORM: PROBLEM LOG</title>
<h2><font face="ariel"><font size=5>Problem Log</font></h2>
</head>
<body>
<?
if($submit) //If submit is hit
{
$Conn = mysql_connect("localhost","root","smsmvv");
mysql_select_db("fms", $Conn);
$sql="INSERT INTO fms_tbl_activities (JK_Key) VALUES ('$_POST['JK_Key']')";
$query = mysql_query($sql) or die ("Cannot query the fms database.<br>" .mysql_error());
echo "Database Updted.";
} else {
?>
<?$Conn = mysql_connect("localhost","root","smsmvv");
mysql_select_db("fms", $Conn);
?>
<Form name ="problem" method="post" action="<?php echo $PHP_SELF;?>">
<b>JK: </b>
<select name='JK_Key'>
<?$result = mysql_query("SELECT JK_Key FROM fms_tbl_jk");
if ($POST = mysql_fetch_array($result)) {
do { ?>
<option value="<? echo $POST['JK_Key']; ?>"><? echo $POST['JK_Key']; ?></option>
<?
} while ($POST = mysql_fetch_array($result));
}
?>
</select>
<br>
<br>
<INPUT TYPE="submit" name="submit" value="submit">
</select>
</form>
<?php
}
?>
</body>
</html>