Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

a form that selects data and/or adds to menu choices

I want to design a form

there are two form input elements

option select

and

textbox





------------------
if user enters data into textbox
then
do not use option select
add to option select menu choices
mysql insert into categories column


else if user choses option select
use option select menu choice

------


sample data:

categories option select:
electronics
silverwear
bedding

textbox:
user enters new category: keyboards


now option select:
electronics
silverwear
bedding
keyboards
Avatar of Ahmed Merghani
Ahmed Merghani
Flag of Sudan image

Hello,

Your PHP code will be something like this:

if($_POST['text_input']  != ""){
     //code to insert the new category option in the database
}else if($_POST['option_select']  != ""){
    //use the selected option menu
}
ASKER CERTIFIED SOLUTION
Avatar of Jagadishwor Dulal
Jagadishwor Dulal
Flag of Nepal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgb192

ASKER

works great

only lets user enter text data when dropdown is chosen

thanks