By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

Insert data through dropdown box

100+
P: 250
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
Share this Question
Share on Google+
1 Reply


dlite922
Expert 100+
P: 1,584
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.