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

checkboxes in MYSQL table

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%">Arbitrators</td>
</tr>
<tr>
<td width="6%"><input name="status[]" id="st3" type="checkbox" value="bcd"></td>
<td width="44%">Builders,Contractors and Developers</td>
<td width="6%"><input name="status[]" id="st4" type="checkbox" value="bcd"></td>
<td width="44%">Civil Engineers and Contractors</td>
</tr>
<tr>
<td width="6%"><input name="status[]" id="st5" type="checkbox" value="survey"></td>
<td width="44%">Surveyors</td>
<td width="6%"><input name="status[]" id="st6" type="checkbox" value="cse"></td>
<td width="44%">Consulting and Structural Engineers </td>
</tr>
<tr>
<td width="6%" height="39"><input name="status[]" type="checkbox" id="st7" value="eec"></td>
<td width="44%">Electrical Engineers and Contractors</td>
<td width="6%"><input name="status[]" type="checkbox" id="st8" value="ld"></td>
<td width="44%">Landscape Designers </td>
</tr>
<tr>
<td width="6%"><input name="status[]" type="checkbox" id="st9" value="idd"></td>
<td width="44%">Interior Decorators and Designers</td>
<td width="6%"><input name="status[]" type="checkbox" id="st10" value="pcc"></td>
<td width="44%">Pest Control Consultants </td>
</tr>
<tr>
<td width="6%" height="34"><input name="status[]" type="checkbox" id="st11" value="tkc"></td>
<td width="44%">Turnkey Contractors</td>
<td width="6%"><input name="status[]" type="checkbox" id="st12" value="urp"></td>
<td width="44%">Urban and Rural Planners</td>
</tr>
<tr>
<td width="6%"><input name="status[]" type="checkbox" id="st13" value="valp"></td>
<td width="44%">Value and Appraisers - Land and Property</td>
<td width="6%"><input name="status[]" type="checkbox" id="st14" value="wpcc"></td>
<td width="44%">Water Proofing Consultants and Contractors </td>
<tr>
<td width="6%"><input name="status[]" type="checkbox" id="st15" value="pcc"></td>
<td width="44%">Plumbing Consultants and Contractors</td>
<td width="6%"><input name="status[]" type="checkbox" id="st16" value="urp"></td>
<td width="44%">Consultants(Specify)</td>
</tr>
<tr>
<td width="6%"><input name="status[]" type="checkbox" id="st17" value="others"></td>
<td width="44%">Others</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%"><textarea 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%">Award/Honours won:</td> <td width="60%"><input 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%"><input type="text" size="20" name="key"> </td>
<td colspan="5">Designation: </td><td width="35%"><input type="text" size="20" name="design"> </td>
</tr>
</table>
</form>[/HTML]
Oct 24 '07 #1
1 2998
realin
254 100+
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
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...
4
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...
10
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...
2
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
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...
5
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...
1
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...
10
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.