HI guys i have a little problem while i post the data that is class_id and subject_id to my db with it extra field is generated having zero in class_id and subject_id e.g below
Edit Delete 0 0
Edit Delete 315 1
beside the original ids.here is my code below i cant figure it out that why is this happening can someone help me
<?php
if(isset($_POST)){
$con = mysql_connect("localhost","root","");
if ($con)
{
/* die('connected: ' );*/
}
else{
die ("not connected");
}
$db_selected = mysql_select_db("project", $con);
$subject = $_POST['subject_name'];
$id = $_POST['id2'];
///insertion code
$sql = mysql_query("INSERT INTO `connection` (subject_id,class_id) VALUES ('$subject','$id') ");
}
?>
<html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/div_validation.js"></script>
<link rel="stylesheet" type="text/css" href="css/connection.css" />
</head>
<body>
<div id="form2">
<center id="Center">
Enter Subject
</center>
</div>
<hr id="new">
</hr>
<center class="Center">
<form id="class" class="class" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" style="width:600px">
<div class="test">
<select class="form-dropdown" style="
width: 150px;" >
<option> </option>
<option value="Option 1"> Option 1 </option>
<option value="Option 2"> Option 2 </option>
<option value="Option 3"> Option 3 </option>
</select>
<label class="label1"> Go to
</label>
</div>
<p class="name1">
<select id="id2" name="id2">
<option value="" selected="true"></option>
<option value="315">315</option>
<option value="316">316</option>
<option value="317">317</option>
</select>
<label for="name"><i>Class id</i></label>
</p>
<p class="name">
<select id="subject_name" name="subject_name">
<option value="" selected="true"></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<label for="name"><i>Subject id</i></label>
</p>
<p class="submit">
<input type="submit" id="submit"value="Submit" />
</p>
</form>
</center>
<div id="msg"></div>
<color> <horizontal offset> <vertical offset> <blur>
</body>
</html>