Hi,
I know this seem to be a huge problem, but i just cant seem to find a solution that works for me, so any help would be appreciated.
Im trying to fill in a mysql database using a form, and when i click any of the checkboxes it gives me an 'array' entry in the column, as opposed to the checkbox selected.
This is the code for the form
<form action="form.php" method="post">
Lat : <input type="text" name="lat"> <br /><br />
Lon: <input type="text" name="lon"> <br /><br />
Des: <textarea name="desciption" rows="6" cols="20"> </textarea> <br /><br />
Pre: <input type="checkbox" name="period[pre]" value="pre" /> Pre 1970 <br />
Post: <input type="checkbox" name="period[post]" value="post" /> Post 1970 <br>
<p align="center"> <input type="submit" value="Save to database" ></p>
</form>
and this is the form.php processing it
<?php
$con = mysql_connect("localhost","root","xxxxxxx");
if (!$con) {
die('Could not connect: ' . mysql_error()); }
mysql_select_db("gmapeg", $con);
$sql="INSERT INTO wholocations (lat,lon,desciption,period)
VALUES('$POST[lat]', '$POST[lon]', '$POST[desciption]', '$POST[period]')";
if (!mysql_query($sql,$con)){
die('Error: ' . mysql_error()); }
echo header("Location: index.php");
mysql_close($con)
?>
This is an example of the result i get:
+----+-----------+-----------+-----------------+--------+
| id | lat | lon | desciption | period |
+----+-----------+-----------+-----------------+--------+
| 1 | 51.515972 | -0.237457 | Shepps | 0 |
| 3 | 51.462620 | -0.216308 | Putney | 0 |
| 4 | 51.460932 | -0.116024 | Brixton | 0 |
| 82 | 0.000000 | 0.000000 | | Array |
+----+-----------+-----------+-----------------+--------+