Necesito que cuando selecionen una opcion y den click en el boton guardar me guarde y mi base de datos pero no como programar la parte php.
<!DOCTYPE html>
<html>
<head>
<title>Prueba Select</title>
</head>
<body>
<center>
<select name="users" onchange="showUser(this.value)">
<option value="">Select a person:</option>
<option value="1">Peter Griffin<</option>
<option value="2">Lois Griffin<</option>
<option value="3">Joseph Swanson<</option>
<option value="4">Glenn Quagmire<value="4">Glenn</option>
</select>
<input style="border-radius: 8px" type="submit" name="Guardar" value="Guardar">
</center>
</body>
</html>
<?php
$q = intval($_GET['q']);
$con = mysqli_connect('localhost','root','admin123','database');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,"ajax_demo");
$sql="SELECT * FROM user WHERE id = '".$q."'";
$result = mysqli_query($con,$sql);
echo "<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "<td>" . $row['Age'] . "</td>";
echo "<td>" . $row['Hometown'] . "</td>";
echo "<td>" . $row['Job'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>