I have a form that takes variables from another form like so:
$employeeid = $_POST['modifyid'];
$fname = $_POST['modifyfn'];
$lname = $_POST['modifyln'];
$staffno = $_POST['modifysn'];
$empusername = $_POST['modifyeu'];
</br>
<td><form action="empmodify.php" method="post">
<?php echo
"<div class='form-group'>
<tr><td>ID:</td><td>
<input type='text' class='form-control' name='modid' value='" . $employeeid . "'/>
</td></tr>
</div>
<div class='form-group'>
<tr><td>First Name:</td><td>
<input type='text' class='form-control' name='modfn' value='" . $fname . "'/>
</td></tr>
</div>
<div class='form-group'>
<tr><td>Surname Name:</td><td>
<input type='text' class='form-control' name='modln' value='" . $lname . "'/>
</td></tr>
</div>
<div class='form-group'>
<tr><td>Staff number:</td><td>
<input type='text' class='form-control' name='modsn' value='" . $staffno . "'/>
</td></tr>
</div>
<div class='form-group'>
<tr><td>Username:</td><td>
<input type='text' class='form-control' name='modeu' value='" . $empusername . "'/>
</td></tr>
</div>
<button type='submit' class='btn btn-default'>Modify this Employee</button>"?>
</form></td>
</div>
These variables are already in the database - This part is working. What I would like is that when the user clicks submit it updates the record with anything they have changed in this form. Here is my empmodify.php:
$employeeid = $_POST['modid'];
$fname = $_POST['modfn'];
$lname = $_POST['modln'];
$staffno = $_POST['modsn'];
$empusername = $_POST['modeu'];
$result = mysql_query("UPDATE employee SET fname = '$fname', lname = '$lname', staffno = '$staffno', empusername = '$empusername' WHERE employeeid = '$employeeid'");
I have tried so many things with my variables but the update statement just doesn't seem to be working. I tried single quotes, double quotes, post, and concatenating them but nothing.. any ideas? :)