I am a newbie to mysql and PHP thanks to Kevin. I am trying to use pull-down menus in a form, but when I select something it does not populate to mysql.
Here is a snippet:
Sub Category:<select multiple name="subcategory[]">
<option value="Test">Test
<option value="Test2">Test 2
</select>
I used ENUM for the column type and my submission is still not populating my Sub Category Category.
Can anyone help me?
Thanks
Dylan
using the forms from the "content management section of php and my
Well the form code you posted looks right. Now let's see the PHP code responsible for accepting that form data and placing it into your MySQL. I'd bet that's where the problem lies.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote/font><HR>Originally posted by kyank: Well the form code you posted looks right. Now let's see the PHP code responsible for accepting that form data and placing it into your MySQL. I'd bet that's where the problem lies. <HR></BLOCKQUOTE>
Hi Kevin, I was using your PHP code that you furnished....this is what I am using:
<?php
if ($submit): // A new business has been listed // using the form below.
$sql = "INSERT INTO Business SET " .
"Business_Name='$businessname', " .
"Category='$category', " .
"Sub_Category='$subcategory', " .
"Neighborhood='$neighborhood', " .
"Business_Description='$businessdescription".
"Address_1='$address1', " .
"Address_2='$address2', " .
"City='$city', " .
"State='$state', " .
"Phone_Number='$phonenumber', " .
"E_Mail='email', " .
"Web_Site='$website', " .
"Contact_Name='$contactname', " .
"Date=CURDATE(),".
"Expiration_Date='$expirationdate'";
if (mysql_query($sql)) {
echo("<P>New Business Listing Added</P>");
} else {echo("<P>Error Adding New Business Listing: " .mysql_error() . "</P>");
}
?>
<P><A HREF="<?php echo($PHP_SELF); ?>">
Add Another Business Listing</A></P>
<P><A HREF="authors.php">Return to Authors list</A></P>
<?php else: // Allow The User To Enter A New Business Listing
?>
<FORM ACTION="<?php echo($PHP_SELF); ?>" METHOD=POST>
<P>Enter Business Information:<BR>
Business Name:
<INPUT TYPE=TEXT NAME="businessname" SIZE=50 MAXLENGTH=100><BR>
Sub Category:<select multiple name="subcategory[]">
<option value="Test">Test
<option value="Test2">Test 2
</select><br>
Bookmarks