Does not populate the table!
Posted: Sun Oct 03, 2010 3:07 pm
Hi,
Below is a bit of simple code which I am trying to use, but amazingly it is not getting inserted to the table.
The print_r is showing the array correctly.
But the insert into query is not working. Is there any probable reason?
Below is a bit of simple code which I am trying to use, but amazingly it is not getting inserted to the table.
Code: Select all
<html>
<form action="testmulti.php" method="post">
<select multiple="yes" size="3" name="services[]">
<option value="food">Food Products</option>
<option value="apparels">Apparels</option>
<option value="electronics">Electronics</option>
<option value="beauty">Beauty Services</option>
<option value="taxnfinance">Tax and Finance</option>
<option value="it">Information Technology</option>
</select>
<input type="submit" value="Submit" />
</form>
</html>Code: Select all
<?php
print_r($_POST['services']);
include 'connection.php';
foreach($_POST['services'] as $val) {
mysql_query("INSERT INTO test_multi (values)
VALUES ('$val')");
}
?>But the insert into query is not working. Is there any probable reason?