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 </option>
<option value="2">Lois </option>
<option value="3">Joseph </option>
<option 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>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>