473,761 Members | 9,864 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

checkboxes in MYSQL table

63 New Member
Hi to all.
I have got a form containing of checkboxes along with other items.
I have simply no clue as to
(i) how to make entry for those checkbox data into the mysql table . I mean : what query to put for creating field corresponding to checkboxes. Create table arc(status ---?)
status is the array for checkboxes. what should be the data type and its length.

(II)How to post data from the checkboxes correctly into the database on submit.
Here is the table . plz help


[HTML]<form>
Status (Tick as many as applicable):<br/>
<table width="86%">
<tr>
<td ><input name="status[]" id="st1" type="checkbox" value="accc"></td>
<td width="44%">Air Conditioning Consultants and Contractors</td>
<td ><input name="status[]" id="st2" type="checkbox" value="arbit"></td>
<td width="44%">Arb itrators</td>
</tr>
<tr>
<td width="6%"><inp ut name="status[]" id="st3" type="checkbox" value="bcd"></td>
<td width="44%">Bui lders,Contracto rs and Developers</td>
<td width="6%"><inp ut name="status[]" id="st4" type="checkbox" value="bcd"></td>
<td width="44%">Civ il Engineers and Contractors</td>
</tr>
<tr>
<td width="6%"><inp ut name="status[]" id="st5" type="checkbox" value="survey"> </td>
<td width="44%">Sur veyors</td>
<td width="6%"><inp ut name="status[]" id="st6" type="checkbox" value="cse"></td>
<td width="44%">Con sulting and Structural Engineers </td>
</tr>
<tr>
<td width="6%" height="39"><in put name="status[]" type="checkbox" id="st7" value="eec"></td>
<td width="44%">Ele ctrical Engineers and Contractors</td>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st8" value="ld"></td>
<td width="44%">Lan dscape Designers </td>
</tr>
<tr>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st9" value="idd"></td>
<td width="44%">Int erior Decorators and Designers</td>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st10" value="pcc"></td>
<td width="44%">Pes t Control Consultants </td>
</tr>
<tr>
<td width="6%" height="34"><in put name="status[]" type="checkbox" id="st11" value="tkc"></td>
<td width="44%">Tur nkey Contractors</td>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st12" value="urp"></td>
<td width="44%">Urb an and Rural Planners</td>
</tr>
<tr>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st13" value="valp"></td>
<td width="44%">Val ue and Appraisers - Land and Property</td>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st14" value="wpcc"></td>
<td width="44%">Wat er Proofing Consultants and Contractors </td>
<tr>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st15" value="pcc"></td>
<td width="44%">Plu mbing Consultants and Contractors</td>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st16" value="urp"></td>
<td width="44%">Con sultants(Specif y)</td>
</tr>
<tr>
<td width="6%"><inp ut name="status[]" type="checkbox" id="st17" value="others"> </td>
<td width="44%">Oth ers</td>
<td width="6%"> </td>
</tr>
</table>
<td>&nbsp;</td><br/>
Projects Executed (max.3):
<table width="66%">
<tr>
<td>(i)</td> <td><textarea name="prexec1" cols="65" rows="5"></textarea></td>
</tr>
</tr>
<tr>
<td>(ii)</td> <td width="95%"><te xtarea name="prexec2" cols="65" rows="5"></textarea></td>
</tr>
<tr>
<tr>
<td>(iii)</td> <td><textarea name="prexec3" cols="65" rows="5"></textarea></td>
</tr>
</table>
<td>&nbsp;</td><br/>
Current Projects :
<table width="66%">
<tr>
<td>(i)</td> <td colspan="5"(ii) ><textarea name="curprj1" cols="65" rows="5"></textarea></td>
</tr>
<tr>
<td>(ii)</td> <td><textarea name="curprj2" cols="65" rows="5"></textarea></td>
</tr>
<tr>
<td>(iii)</td> <td><textarea name="curprj3" cols="65" rows="5"></textarea></td>
</tr>
</table>
<p>&nbsp;</p>
<table>
<tr>
<td width="26%">Awa rd/Honours won:</td> <td width="60%"><in put type="text" size="50" name="awards"> </td>
</tr>
</table>
<table>
<tr><td>
I hereby declare that the above information is true to the best
of my knowledge and belief and have no objection to the data
being used for this or any other publication in print or electronic
media by the publishers. please take me as a subscriber for you
"Web News Letter" free of cost .
</td></tr>
</table>
<br>
<table>
<tr>
<td colspan="5">Key Person : </td><td width="35%"><in put type="text" size="20" name="key"> </td>
<td colspan="5">Des ignation: </td><td width="35%"><in put type="text" size="20" name="design"> </td>
</tr>
</table>
</form>[/HTML]
Oct 24 '07 #1
1 3024
realin
254 Contributor
that is a long post.. well if you want to submit check boxes value using the name of the checkbox to get its value after submission of the form.

Suppose the checkbox name is chk1 then you can do

[PHP]$set=$_POST['chk1'][/PHP]


if $set will be 0 then that means the checkbox was never set if 1 then it was set :)
Oct 24 '07 #2

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

Similar topics

5
8127
by: Ralph Freshour | last post by:
I'm using MySQL to display data on a web page - fitting about 10 records of data per screen - I'm including a checkbox with each record so that I can check it and when the submit button is clicked the called .php script will delete those records that are checked. I'm creating the records from the table with the checkboxes ok (I think): <INPUT TYPE='checkbox' NAME='frm_chk_delete'>Delete
4
7925
by: 'bonehead | last post by:
Okay, I've only been doing php/mysql for a few months and I admit to being a little stumped on this one. I have a form which posts updates to a mysql table. I'd like to use checkboxes to show and update boolean type values. In Access it's very simple to create a field of type Yes/No, bind a form to the table, and bind a checkbox object to the Yes/No field. I am unable to find generic examples of this in php/mysql. 1. What field type...
10
3298
by: frizzle | last post by:
Hi there, I'm building a music site with a mysql backend. It has a many to many relational database. I use this to match music genres with certain artists, to maintain the possibility to add multiple genres to a singe artist. Now i've searched google, but can't find a solution on how to update rows with checkboxes. If an artist gets his genre updated as follows:
2
2737
by: hermanh28 | last post by:
tearing my hair out over this! I have 2 tables: PTable which lists all traits pid,ptype 1,good 2,bad 3,neutral
5
2400
by: hugonot | last post by:
I have got a problem with checkboxes array and the form. I have the results from table (MySQL) and checkbox (form) near the results. I use: echo "<input type=checkbox name=box value=".$.">"; for checkbox i.e. I create array of checkbox. How can I remember the state of checkboxes in array and pass it by GET? I know how to do it with a single checkbox already selected inside the code: $next = " <a...
5
7428
by: purush2purush | last post by:
HI All.... cud any one provide me the code for : Selecting mulitiple checkboxes and sending mail when clicked on submit button. The checkboxes are retrived from the Mysql table .The code for the check boxes is here...... while($row = mysql_fetch_array($result))
1
2588
by: recordlovelife | last post by:
Hey guys, ill try to make this simple. I want to make a GUI for a client so that they can delete news entries that they have posted. I figure I can code a site that will query the table for the news and post the titles of all of the news entries, and put a check box next to each one. The name of the check box will be the id number of the row in the MySQL table where the news entry is located. So if they click a check box, when they hit submit,...
10
2386
by: beam1985 | last post by:
So my problem lays in the $_POST if statement at the bottom operation, I keep getting Notice: Undefined index: delete and also Notice: Undefined index: checkbox. Please let me know if you have any ideas or suggestions im desperate to get this working, its part of my midterm project due tomorrow! Thank you so much $host="localhost"; // Host name $username="username"; // Mysql username $password="pass"; // Mysql password ...
2
3045
faugustin
by: faugustin | last post by:
Hello, I'm stuck in my developing of a filmcatalogue-type db. I have 3 tables and 2 html-forms. The form for the films is working ok- it's based on text inputs. BUT I can't get the form for "genres" to work; I want to use checkboxes with 11 genre/types, because a film must be specified with...say 3 attributes (e.g. drama, action, war...). I want the result to be boolean in the table (1 or 0, not null) and select the 1's in PHP to present it...
0
9531
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9957
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7332
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.