I made a update form for my MySQL database but for some reason it isn't updating my database. It works without errors but it doesn't do anything..... Could someone tell me what I'm doing wrong?
***EDIT
updated the script but it still isn't working.....
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/layout.css"/>
</head>
<body>
<div id="menu">
<div id="menu_wrapper">
<ul>
<li>Configuratiebeheer<img src="afb/pijltje.png" width="10"/></a>
<ul>
<li><a href="configuratiebeheer_hardware.php">Lijst hardware</a></li>
<li><a href="hardware_toevoegen.php">Hardware toevoegen</a></li>
<li><a href="hardware_verwijderen.php">Hardware verwijderen</a></li>
</ul>
</li>
</ul>
</div>
</div>
<?php
$connect=mysql_connect("localhost", "root","");
mysql_select_db("helpdesk_middenpolder", $connect);
$id=$_GET['id'];
$q="SELECT * FROM hardware WHERE hardwareID=$id";
$r=mysql_query($q);
echo "<form method='post'>";
echo "<table border='1'>";
echo "<th>merknaam</th><th>producttype</th><th>hardwaretype</th>";
while ($x=mysql_fetch_array($r)){
echo "<tr>";
echo "<td>";
echo "<input type='text' value='".$x['merknaam']."'>";
echo "</td>";
echo "<td>";
echo "<input type='text' value='".$x['producttype']."'>";
echo "</td>";
echo "<td>";
echo "<input type='text' value='".$x['hardwaretype']."'>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
?>
<?php
if(isset($_POST['updatehardware'])){
$query = "UPDATE hardware SET merknaam='".$_POST['merknaam']."', producttype='".$_POST['producttype']."', hardwaretype='".$_POST['hardwaretype']."' WHERE hardwareID=".$id."";
mysql_query($query);
}
?>
<?php
mysql_close($connect);
?>
<input type="submit" name="updatehardware" value="Hardware updaten">
</form>
</body>
</html>
Thanks in advance!