473,387 Members | 1,624 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,387 software developers and data experts.

checkbox- if statement

Yo Yo Yo, hey guys

lol a tricky question for my limited php skills, lol but i bet you will be laughin your head of when i ask about it.

i have a form that asks users to fil out information about stock, its got loads of checkbox's with YES or No options.

so they fil in the form, e.g do you have blue walls YES or No, say no is checked, then no is displayed,

so my code says this


is wall blue? $checkbox1 ,

but that only gives me the option to display 1 answer, which in this case would always be YES, so how do i go about going the if statement to see which box has been checked?
Apr 12 '07 #1
3 4066
exoskeleton
104 100+
hi sir...i think you may use radio button coz if check box you can check both YES and NO.

then the radio button have the same name of course in order to choose one of them. then for example radio button :

[HTML]<form name="form1" method="post" action="">
<input type="radio" name="radiobutton" value="YES">
<input type="radio" name="radiobutton" value="NO">
</form>[/HTML]

upon submit for example:

[PHP]$radiobutton = $_POST['radiobutton'];

if ($radiobutton=='YES') {

echo "YES";

} else {

echo "NO";

}[/PHP]
thats only and example ... hope this helps...
Apr 13 '07 #2
hi sir...i think you may use radio button coz if check box you can check both YES and NO.

then the radio button have the same name of course in order to choose one of them. then for example radio button :

[HTML]<form name="form1" method="post" action="">
<input type="radio" name="radiobutton" value="YES">
<input type="radio" name="radiobutton" value="NO">
</form>[/HTML]

upon submit for example:

[PHP]$radiobutton = $_POST['radiobutton'];

if ($radiobutton=='YES') {

echo "YES";

} else {

echo "NO";

}[/PHP]
thats only and example ... hope this helps...
thank you :)
Apr 13 '07 #3
exoskeleton
104 100+
No problem sir... :D

But you must help me when I am in need. hehehe :D
Apr 14 '07 #4

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

Similar topics

4
by: Fabri | last post by:
How can I, on button click, to select ONLY the following 4 checkbox? I would like to do this without a for loop through form.lenght because this is only an example and I have to apply this script...
4
by: feanor | last post by:
I need to select children checkboxes when selecting the parent one. This is my function: function SelectChildrens(checkbox_name){ form = document.forms; Sname = checkbox_name.split("-"); for...
0
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a...
5
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.......
2
by: Adam Knight | last post by:
Hi all, I have a datagrid with a checkbox in one column. The checkbox is set to autopostback and calls a method named UpdateMailSubscribers. The first click on the checkbox cause the page to...
2
by: Ceema M via DotNetMonster.com | last post by:
Hello all, I have a nested repeater, which displays categories(parent repeater) and corresponding subcategories(child repeater). Both repeaters have checkboxes. When I check category checkbox...
4
by: Wolfgang Uhr | last post by:
Hello I've the following code Panel pnlData = new System.Windows.Forms.Panel(); CheckBox checkBox = new System.Windows.Forms.CheckBox(); checkBox.AutoSize = true; checkBox.Dock =...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.