Hi everyone...I am pretty new at PHP, though I have worked a little with it in the past. I am working on a project for a weather forecasting website. What I want to do is have a form for the forecaster to fill out, with things like the high and low temperature, and when they hit sumbit, I want it to save each attribute in its appropriate spot. That is the end goal I have in mind.
For the short term however, I am just trying to get a simple form write to a piece of information to a simple file. However, I am getting the error: Parse error: syntax error, unexpected T_STRING in /home/groton08/public_html/test2/output2.php on line 2
Here is the php I have:
<?php
$data = 'The zone is: $_POST['zone']';
$forecast = "forecast.html";
$fh = fopen($forecast,'w') or die ("cant open file");
fwrite($fh,$data);
fclose($fh);
?>
and here is my HTML form:
<html>
<body bgcolor="000000" text="ffffff">
<form action="output2.php" method="post">
<b>Forecast Zone:<b><br>
<select name="zone">
<option value="zone 1">Zone 1</option>
<option value='zone 2'>Zone 2</option>
</select>
<input type="submit" value="Click Here to Get Your Codes!">
</form>
</body>
</html>
I hope that makes sense...let me know if I am not explaining my goals and problem well. But if someone can help me out with that error to start at least, I would be very grateful! Thanks!