I've read the articles on inserting an array into a Mysql, but I can't figure out why my code, below,doesn't work. I'm trying to create an array of zip codes and insert them into a db table. I'm not getting any errors, it just won't insert the data. Any help would be appreciated. Thanks.
//my form
<FORM METHOD="POST" ACTION="do_zipinsert.php">
<b>Combination</b><br><br>
Element 1: <INPUT NAME="zip1" TYPE="TEXT">
<BR>
Element 2: <INPUT NAME="zip2" TYPE="TEXT">
<br>
Element 2: <INPUT NAME="zip3" TYPE="TEXT">
<br>
Element 2: <INPUT NAME="zip4" TYPE="TEXT">
<br>
<INPUT TYPE="Submit" name="add_zips" VALUE"Submit">
</FORM>
//my processing page - do_zipinsert.php
<?php
$ID="6";
$combination[] = ($REQUEST["zip1"].$REQUEST["zip2"].$REQUEST["zip3"].$REQUEST["zip4"]);
print_r ( $combination);
$cats = $combinations;
foreach($cats as $cat) {
$cat_list .= $cat . ' ';
}
;
if ($add_zips == "Submit"){
$sql = "INSERT INTO cat_relations SET
relation_user_id = '$ID',
relation_cat = '$cat_list .'
";
if (@($sql)) {
echo ("Good");
} else {
echo("<p>Error adding cats: " .
mysql_error() . "</p>");
}
}
?>