Last programming project for me was in GWBasic and Turbo Pascal... so please bear with me. I have been struggling to write the result of a drop down list selection to a text file. The code is able to write to the file, but whatever I try not the selected value. Thank you in advance.
<html lang = "nl">
<head>
<title>Thermostaat P7</title>
<meta charset = "UTF-8" />
</head>
<body>
<h1>Living room</h1>
<form name="thermostat" method="POST">
<fieldset>
<legend>Temperature measurement</legend>
<p>
<?php
$file = file_get_contents('/usr/local/bin/python/Templog', true);
echo "The current temperature is $file °C.";
?>
</p>
</fieldset>
<p>
<fieldset>
<legend>Temperature setting</legend>
<p>
<label for="settemp" class="inline">Desired temperature</label>
<select name="settemp" id="comboA" onChange="getComboA(this)">
<option value=null SELECTED><?php $curSet = file_get_contents('/usr/local/bin/python/Tempset'); echo $curSet; ?> °C </option>
<option value = "12">12 °C</option>
<option value = "16">16 °C</option>
<option value = "19">19 °C</option>
<option value = "19.5">19,5 °C</option>
<option value = "20">20 °C</option>
<option value = "20.5">20,5 °C</option>
<option value = "21">21 °C</option>
<option value = "21.5">21,5 °C</option>
</select>
</p>
</fieldset>
</form>
</body>
</html>
<script type="text/javascript">
function getComboA(sel) {
var value = sel.value;
<?php
file_put_contents('/usr/local/bin/python/Tempset', value)
?>
}