how do I update my votes into my sql with my dropdown, textfield and submit button? Im badly need help to fix my codes. its almost 1week and I cant still figure out. this is the scenario if I put 20 in textfield, it will add +20 into my totalvotes column in mysql
this is my textfield and submit button
<?php
$teacherz = $_POST['teacher_dropdown'];
$votecount = $_POST['votecount'];
$sql = "SELECT facultyname FROM subj_eva";
echo "<form method='post' action='cof_test.php'>
<input type='text' name='votecount'>
<input type='submit' name='submit' value='Submit now'>
</form>";
$teacherz = $_POST['teacher_dropdown'];
$votecount = $_POST['votecount'];
$sql = "SELECT facultyname FROM subj_eva";
if (isset($_POST['submit'])) {
$sql = "UPDATE $subj_eva SET facultyname='$teacherz', totalvotes=totalvotes + '$votecount'";
}
$result=mysql_query($sql);
?>
and this one is my dropdown
<?php
mysql_connect('localhost', 'root', 'password');
mysql_select_db('ramon_pascual');
$sql = "SELECT facultyname FROM subj_eva";
$result = mysql_query($sql);
echo "<select name='teacher_dropdown'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value'" . $row['facultyname'] ."'>" . $row['facultyname'] . "</option>";
}
echo "</select>";
?>