after using the changes i am not getting any of the select input store in the database. The database for category is just blank. Here is the script I have now.
<?php
//If new bar is added submit it
if($submit)
{
$db = @mysql_connect("$dbhost", "$dbuser", "$dbpassword");
@mysql_select_db("$dbname",$db);
$categories = implode("_",$_POST['category']);
$sql = "INSERT INTO bar (id, letter, name, location, category, description, rank, address, crossaddress, city, state, zip, areacode, phone, url, image, expires, lastupdate) VALUES "."('".$_POST['id']."','".$_POST['letter']."','".$_POST['name']."','".$_POST['location']."','".$categories."','".$_POST['description']."','".$_POST['rank']."','".$_POST['address']."','".$_POST['crossaddress']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zipcode']."','".$_POST['areacode']."','".$_POST['phone']."','".$_POST['url']."','".$_POST['logo']."','".$_POST['expire']."','".$_POST['lastupdate']."')";
$result = mysql_query($sql);
echo "<h1>Thank you! Information entered.\n</h1>";
echo "<P>Your entry has been added. Would you like to <a href=\"addedit.php\">add another</a>?</p>";
}
else if($update)
{
$db = mysql_connect("$dbhost", "$dbuser","$dbpassword");
mysql_select_db("$dbname",$db);
$category = implode("_",$_POST['category']);
$sql = "UPDATE bar SET id='".$_POST['id']."', letter='".$_POST['letter']."', name='".$_POST['name']."', location='".$_POST['location']."', category='".$categories."', description='".$_POST['description']."', rank='".$_POST['rank']."', address='".$_POST['address']."', crossaddress='".$_POST['crossaddress']."', city='".$_POST['city']."', state='".$_POST['state']."', zip='".$_POST['zipcode']."', areacode='".$_POST['areacode']."', phone='".$_POST['phone']."', url='".$_POST['url']."', image='".$_POST['logo']."', expires='".$_POST['expire']."', lastupdate='".$_POST['lastupdate']."' WHERE id='".$_POST['id']."'";
$result = mysql_query($sql);
echo "Thank you! Information updated.\n";
echo "<P>Your entry has been updated. Would you like to <a href=\"viewdb.php\">update another</a>?</p>";
}
else if($id)
{
$db = mysql_connect("$dbhost", "$dbuser","$dbpassword");
mysql_select_db("$dbname",$db);
$result = mysql_query("SELECT * FROM bar WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type="hidden"name="id"value="<?php echo $myrow["id"]?>">
<table>
<tr>
<th colspan=2>
Update A Listing
</th>
</tr>
<tr>
<td class="required" colspan=2>
<b>* if red then you MUST enter data</b><br /><br />
</td>
</tr>
<tr>
<td class="required">
<b>*Bar Letter</b>
</td>
<td>
<input type="text" name="letter" size=2 maxlength=1" value="<?php echo $myrow["letter"]?>">
</td>
</tr>
<tr>
<td class="required">
<b>*Bar Name</b>
</td>
<td>
<input type="text" name="name" size=30 maxlength=100" value="<?php echo $myrow["name"]?>">
</td>
</tr>
<tr>
<td class="required">
<b>*Category</b>
</td>
<td>
<SELECT NAME="category[]" class="input" size="3" multiple="yes">
<option value="Bar">Bar</option>
<option value="Club">Club</option>
<option value="Live Music">Live Music</option>
<option value="Lounges">Lounges</option>
<option value="Restaurant">Restaurant</option>
<option value="Other">Other</option>
</SELECT>
</td>
</tr>
<tr>
<td class="required">
<b>*Address</b>
</td>
<td>
<input type="text" name="address" size=30 maxlength=100" value="<?php echo $myrow["address"]?>">
</td>
</tr>
<tr class="favcolor2">
<td colspan=2>
<input class="submit" type="submit" name="update" value="Update Information">
<p><br></p>
</td>
</tr>
</table>
</form>
<?
}
else
{
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<table>
<tr>
<th colspan=2>
Add A Listing
</th>
</tr>
<tr>
<td class="required" colspan=2>
<b>* if red then you MUST enter data</b><br><br>
</td>
</tr>
<tr>
<td class="required">
<b>*Bar Letter</b>
</td>
<td>
<input type="text" name="letter" size=2 maxlength=1">
</td>
</tr>
<tr>
<td class="required">
<b>*Bar Name</b>
</td>
<td>
<input type="text" name="name" size=30 maxlength=100">
</td>
</tr>
<tr>
<td class="required">
<b>*Categories</b>
</td>
<td>
<SELECT NAME="category[]" class="input" size="3" multiple="yes">
<option value="Bar">Bar</option>
<option value="Club">Club</option>
<option value="Live Music">Live Music</option>
<option value="Lounges">Lounges</option>
<option value="Restaurant">Restaurant</option>
<option value="Other">Other</option>
</SELECT>
</td>
</tr>
<tr>
<td class="required">
<b>*Address</b>
</td>
<td>
<input type="text" name="address" size=30 maxlength=100">
</td>
</tr>
<tr class="favcolor2">
<td colspan=2>
<input class="submit" type="submit" name="submit" value="Enter Information">
<p><br /></p>
</td>
</tr>
</table>
</form>
<?
}
?>
</body>
</html>