473,385 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 2021
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

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

Similar topics

2
by: Tavish Muldoon | last post by:
What a pain trying to insert data into a table from a stored proc. My webform asks for 16 pieces of data - which then gets written to the database. I found this easier than the crap below...
2
by: Santo Santis | last post by:
How can I make an .exe file that can insert data automatically in a SQLServer database, I can do it in C, but how can I connect to SQLServer and execute a query. All data that I have to insert...
9
by: Hi5 | last post by:
Hi, Any Idea how, I can make an Insert statement to insert data into 6 different tables, that are all holding all data of my database? Is there any example? I would be grateful if you could...
0
by: Mamatha | last post by:
Hi When i clicked a button, i want to insert data from listview in VB.NET to Excel sheet. If you know the solution either above or below is ok for me. I know how to insert from a textfile,but...
1
by: reagen | last post by:
dear all, please help me that my script cannot insert data to ms acces. <%@ Page Language="vb" ContentType="text/html"%> <%@ Import NameSpace = "System.Data" %> <%@ Import NameSpace =...
0
by: danishce | last post by:
Hello, I want to insert data directly into my windows form data grid and load a combobox(userid) in the 1st column of data grid,a textbox(password) in 2nd column of datagrid. The code for insert...
1
by: Doc11 | last post by:
I'm trying to allow users insert data into a database using the form view. But when I click the insert button I get this error: Server Error in '/Customer Database' Application....
1
by: mahitha1 | last post by:
i have been trying to insert data into database from an html form which contain dropdown menus and text boxes in php using mysql as database.but iam getting the message that record has been added but...
0
by: troydixon | last post by:
Hello, I am new at this, and have been trying to insert data into a table by using the footer of a gridview (which I dont like) or by using a detials view on the same page that is doing the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.