<html>
<head>
<title>Insert into refresh</title>
</head>
<body>
<?php
if(isset($_POST["switch"])){
include("connect.php");
$switch=$_POST["switch"];
$insert_refresh=$dbh->query("insert into refresh (item,type) values('tcrm','$switch')");
echo "Switch has been inserted";
}
?>
<form method="post">
<select name="switch" onchange="this.form.submit()">
<option value="">Switch</option>
<option value="1">On</option>
<option value="0">Off</option>
</select>
</form>
</body>
</html>
