I have a page where values from a table in my database are being pulled out and shown on a drop down list. Once a value is chosen and the form is submitted, every data apart from the drop down list is submitted to my mysql database. the code is as follows:
<?
$sql="SELECT user_id, firstname FROM Users WHERE role = 'chairperson'";
$result=mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result)) {
$id=$row["user_id"];
$thing=$row["firstname"];
$options.="<OPTION VALUE=\"$id\">".$thing;
}
?>
<form action="meetingsinserted.php" method="post">
...
<tr>
<td> <label for="chairperson">Chairperson:</label>
</td>
<td><span id="spryselect1">
<select name="thing" id="chairperson">
<OPTION VALUE=0>
<?=$options?>
</select>
<span class="selectRequiredMsg">You Must Choose A Chairperson For This Meeting</span></span></td>
</tr>
...
meetingsinserted.php page is as follows:
<?php
$title = $_REQUEST['title'];
$chairperson = $_REQUEST['chairperson'];
$secretary = $_REQUEST['secretary'];
$tof = $_REQUEST['tof'];
$occurances = $_REQUEST['occurances'];
$con = mysql_connect("*********","***","****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db('mdb_hj942', $con);
$sql="INSERT INTO Meetings (title, chairperson, secretary, tof, occurances) VALUES ('$title','$chairperson', '$secretary','$tof','$occurances')";
if (!mysql_query($sql,$con))
{
echo '<h1>Meeting Has Been Sent To Chairperson For Approval</h1>';
die('Error: ' . mysql_error());
}
?>
any ideas guys? thanks..
It should be
Also, consider adding closing tag for