Need Help Programming PHP DropDown Menu?

d_monie3

New member
Ok, so I am needing to create a drop down menu within a form for PHP... The issue I am having, though, is I cannot get it to write to my database. Below is a gist of the code, of course there is much more. The database is name "project" and the table is called "ContactUs". I have other info that is writing just fine, it is the drop down that doesn't write... I copied some of the code, so I am sure some of it is wrong. Thanks in advanced.

<?php
$concern = Array("Product Feedback", "Return Process", "General Inquiry", "Business Realtions");
?>
<?php
function showOptionsDrop($array, $active, $echo=true){
$string = '';

foreach($array as $k => $v){
$s = ($active == $k)? ' selected="selected"' : '';
$string .= '<option value="'.$k.'"'.$s.'>'.$v.'</option>'."\n";
}

if($echo)
{
echo $string;
}
else
{
return $string;
}
}
?>
<p><label>Concern</label></p>
<select name="concern">
<option value="0">Choose Your Reason for Contacting Us</option>
<?php showOptionsDrop($concern, null, true); ?> <?php echo $concern; ?>
</select>
 
Back
Top