MySql   Invalid data entered in column   field type is enum

Roger Gill
Roger Gill used Ask the Experts™
on
I had created a form, but there is drop down menu its telling me Invalid data entered in column. I created table in SQL and used enum  as field type. Attached you will see main.sql file and folder with INDEX.php form.
main.sql
MainForm.PNG
index.php
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
There is no attachment.

A word SQL doesn't help much. Please be very specific. Microsoft SQL Server, MySQL, etc. Adding a version number helps even more.
EE Topic Advisor
Most Valuable Expert 2014
Awarded 2013
Commented:
There is no attachment that I can see.

An "enum" restricts inputs to certain pre-defined values, so the error message is telling you that you are violating that restriction. Perhaps your php is returning the human readable "name" but it should be returning some "code value" that meets the enum restriction instead.

Please, also (as indicated above), tell us which database you are actually using.
Roger GillManager

Author

Commented:
i apologize for no attachments, I just attached. Please review. Version information: 4.7.9, latest stable version: 4.8.3
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Roger GillManager

Author

Commented:
PHPmyAdmin Version information: 4.7.9, latest stable version: 4.8.3
PortletPaulEE Topic Advisor
Most Valuable Expert 2014
Awarded 2013
Commented:
You query tells us it is MySQL, please use this as a topic in future because "SQL" does NOT tell us what we need to know. (Each database vendor has slightly different syntax.)
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
It's impossible to see from your code what you're actually trying to insert into the State column, but as has already been pointed out - it's an ENUM, so you can only insert one of the pre-defined Enum values. When you submit a form with a dropdown, it's the 'value' part of the dropdown that's submitted, so even though your form shows 'CA' as the selected option, we can't see what the related 'value' is:

<option value='xxx'>CA</option>

The value part has to be one of the allowed enum values.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial