471,853 Members | 1,017 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

Insert data through dropdown box

250 100+
I want to insert data through my web application. I have dropdown box (have 2 values Yes and No)and when i select yes insert record will be 5 and when i select no insert record will be 3. So i cant insert data using same query in php. How can i insert data depend on user selected value?
Feb 12 '08 #1
1 1962
dlite922
1,584 Expert 1GB
I want to insert data through my web application. I have dropdown box (have 2 values Yes and No)and when i select yes insert record will be 5 and when i select no insert record will be 3. So i cant insert data using same query in php. How can i insert data depend on user selected value?
From the amount of information you gave? You'll only need an if Statement.

[PHP]

// assuming you have that YES NO value in a variable called $dropDownBoxValue then...

if (strtoupper($dropDownBoxValue) == 'YES')
{
//insert 5 records
}
if (strtoupper($dropDownBoxValue) == 'NO')
{
//insert 3 records
}

This is not a joke! Give more info = get better answer.


[/PHP]
Feb 12 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Tavish Muldoon | last post: by
2 posts views Thread by Santo Santis | last post: by
1 post views Thread by Doc11 | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.