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

PHP - Checkboxes

1
Hello, I am currently working on a website in which I have checkboxes to select attendance for brainstorming sessions. Currently, you can select multiple checkboxes, but the last one I want to be an option to not attend any sessions. The problem is that I want to deselect or otherwise 'invalidate' the checks on the previous checkboxes if the user checks the last one. Is there anyway to do this? I'm running an AMP server and would prefer not to use javascript, but will if I have to.

Thank you


[PHP]<p><span>Below are Brainstorms which you have registered for or attended.</span></p>
</div>
<?php } ?>

<table border="0" align="left" cellpadding="0" cellspacing="0" class="table_search_frame" >
<tr>
<td class="table_search_title">Brainstorm Type</td>
<td class="table_search_title">Location</td>
</tr>
<tr>
<td class="table_search_item">
<select name="type" class="form_item" onChange="filterBrainstormType(this[this.selectedIndex].value);">
<option value="0">-- All Types --</option>
<option value="<?php echo B_PRO; ?>">&raquo; Professional Brainstorms</option>
<option value="<?php echo B_CS; ?>">&raquo; Community Service Brainstorms</option>
<option value="<?php echo B_TRAIN; ?>">&raquo; Training Session</option>
<option value="<?php echo B_EVENT; ?>">&raquo; Social Event</option>
</select>
</td>
<td class="table_search_item">
<select name="location" class="form_item" onChange="filterBrainstormLocation(this[this.selectedIndex].value);">
<?php
$sql = "SELECT * FROM `tbl_location`;";
$result = run_query($sql);
if($_SESSION['user_type'] == M_SUP)
{
echo "<option value=\"0\">-- All Locations --</option>";
for($i = 0; $i < mysql_num_rows($result); $i++)
{
$row = mysql_fetch_row($result);
if($row[0] == $_SESSION['user_location'])
echo "<option value=\"$row[0]\" selected>&raquo $row[1] $row[2]</option>";
else
echo "<option value=\"$row[0]\">&raquo $row[1] $row[2]</option>";
}
}
else
echo "<option value=\"".$_SESSION['user_location']."\">&raquo ".getMemberLocationName($_SESSION['user_location'])."</option>";
?>
</select>
</td>

</tr>
</table>[/PHP]
Jan 4 '07 #1
1 1792
ronverdonk
4,258 Expert 4TB
You'll have to use JavaScript, unless you want the user to submit extra for PHP to signal.
The following snippet deselects A, B and C when D is clicked.
When A, B, or C is clicked, D will be deselected.[html]<script type="text/javascript">
function ResetAll() {
document.myform.t1.checked=false;
document.myform.t2.checked=false;
document.myform.t3.checked=false;
}
function ResetOne() {
document.myform.t4.checked=false;
}
</script>
<form name="myform">
<input type="checkbox" name="t1" onclick="ResetOne()" value="A">Choice A<br />
<input type="checkbox" name="t2" onclick="ResetOne()" value="B">Choice B<br />
<input type="checkbox" name="t3" onclick="ResetOne()" value="C">Choice C<br />
<input type="checkbox" name="t4" onclick="ResetAll()" value="D">None of the above<br />
</form>[/html]
Ronald :cool:
Jan 4 '07 #2

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

Similar topics

2
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the...
8
by: DylanM | last post by:
I have some checkboxes that are generated from the results of a database search. At the moment, the checkboxes are part of a table making up a form. Users are going through the form, clicking the...
8
by: Ralph Freshour | last post by:
I have multiple checkbox's created with an array name because I have many on the same web page - their names are like: frm_chk_delete frm_chk_delete frm_chk_delete frm_chk_delete etc. Here...
5
by: @(none) | last post by:
I have a page which is a set of CheckBoxes generated daily and thus the number of Checkboxes changes each day. What I want to do is allow the user to select one or more checkboxes and the push a...
6
by: terence.parker | last post by:
I currently have the following JS in my header: function checkall(thestate) { var checkboxes=eval("document.forms.EssayList.file_id") for (i=0;i<checkboxes.length;i++)...
2
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the...
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....
5
by: masterej | last post by:
Developers, Is there any way to disable all checkboxes on a form? I have a form with 160 checkboxes and I want to be able to disable all of them. Is there a way I can do something like this: ...
8
by: PeteOlcott | last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html I would like to completely understand how GUI controls such as this one are constructed. In the...
7
by: viki1967 | last post by:
I need one function javascript that: 1) when I enter in this htm page I see enabled only checkbox of categories A, M and T; checkboxes of microcategories all disabled; 2-a) If I select the...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
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: 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...

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.