All - I am trying to complete a simple task in passing an array of data to my MS Access database and then display this information in a list page. I searched this and other forums & tutorials and cannot come up with a complete answer to this issue.
Here is the code:
Form page snippet
=================
Action page snippet
=================
Thanks in advance.
Here is the code:
Form page snippet
=================
Code:
<div class="row">
<label>Event(s):</label>
<span><input type="checkbox" class="chkbx" name="events[]" value="forest" /><label>Forest</label></span>
<span><input type="checkbox" class="chkbx" name="events[]" value="laurelvalley" /><label>Laurel Valley</label></span>
</div>
Action page snippet
=================
Code:
<h2>Add Individual</h2>
<?php
// create database connection
include("includes/connection.php");
// set variables
$companyName = $_POST['companyName'];
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$events = serialize($_POST['events']);
$compInfoUpdated = $_POST['compInfoUpdated'];
$persInfoUpdated = $_POST['persInfoUpdated'];
// query to update database
$query = "INSERT INTO tblIndividuals (
companyName,
firstName,
lastName,
events,
compInfoUpdated,
persInfoUpdated)
VALUES (
'$companyName',
'$firstName',
'$lastName',
'$events',
'$compInfoUpdated',
'$persInfoUpdated')";
// run the query
$rs = odbc_exec($conn, $query);
if(!rs)
{exit("Error, insert query failed. No record(s) added.");}
echo "<p>Record has been added.</p>";
odbc_close($conn)
?>
Thanks in advance.