I am currently writing an application where i have a page called devices.php which queries all the records in the mysql database and displays them in an html table. I have a check box in each row of the table, which the user can check, and then click the "edit" or submit button to edit that record. When the submit button is clicked, it takes you to another page, edit_device.php, where you can then edit that device.. i $_GET the value of the checkbox clicked, which is the "primary key" of that record, which i then query the database to enter the values of that query as the default values for another html form.. the goal here is to pull that device into a form, and if they need to change all the column values of that record, they can, or if they need to just edit one column value, they can just erase the default value, and enter in the new one... i am trying to $_GET the values of that form, and update that record within the database.. right now, when i click edit on the devices.php, it takes me to edit_devices.php, and pulls that record form the database and enters them into the fields of the form... the problem i am having though, is when you change one of the values in the form text box/field, it isnt updated in the database. its still just the original values. heres my code:
<!doctype html>
<html>
<?php
include 'dbcon.config';
$id=$GET_['check_box'];
$result=mysql_query("SELECT * FROM device_entries WHERE Id=$id");
$record=mysql_fetch_row($result);
$ident = $record[0];
$suspend = $record[1];
$device = $record[2];
$ipadd = $record[3];
$dep = $record[4];
$emailadd= $record[5];
?>
<body>
<form method="get">
ID: <input type="text" value="<?php echo $ident; ?>" name="id">
Suspended: <input type="text" value="<?php echo $suspend; ?>" name="sus">
Device : <input type="text value="<?php echo $device; ?>" name="device">
IP : <input type="text" value="<?php echo $ipadd; ?>" name="ip">
Dependency: <input type="text" value="<?php echo $dep; ?>" name="depend">
Email: <input type="text" value="<?php echo $emailadd; ?>" name="email">
<input type="submit" value="update" name="submit1">
</form>
</body>
</html>
<?php
if(isset($_GET['submit1'])) {
$id=$_GET['id'];
$sus=$_GET['sus'];
$dev=$_GET['device'];
$ip=$_GET['ip'];
$depend=$_GET['depend'];
$email=$_GET['email'];
$update=mysql_query("UPDATE device_entries SET Suspended=$sus, Device=$dev, IP=$ip, Depend=$depend, Email=$email WHERE Id=$id")
}
mysql_close($con);
?>
The top part seems to be doing what i want it to... it seems like it is something with the $update query.