473,769 Members | 2,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting list of checkboxes and value in next page

Plz help me.Problem is that On the first page I display all other user
with checkbox and give user option to select only two user which he
wants to send message. Tell me please how I'll get those checkboxes
value and name on the next page and send message to only those two
selected user.
Thanx in
advance

Aug 6 '07 #1
4 3313
On Aug 6, 7:15 am, jeet <jatindermash.. .@gmail.comwrot e:
Plz help me.Problem is that On the first page I display all other user
with checkbox and give user option to select only two user which he
wants to send message. Tell me please how I'll get those checkboxes
value and name on the next page and send message to only those two
selected user.
Thanx in
advance
If you are wanting to limit the number of selections (so the user can
only select 2 etc), instead of using checkboxes, I would use radio
buttons or select lists. Anyway, after making the selections and
submitting your form, on the next page you can access the data
selected by using $value=$_POST["obj_name"]; where obj_name is the
name value on your form. With radio buttons, checkboxes, or select
lists the information placed in $value will be whatever you have setup
for the form objects value, or option value. Use $_POST only if you
are using POST for the method to submit the form, otherwise if you use
GET for the method, use $_GET.

Aug 6 '07 #2
jeet wrote:
Plz help me.Problem is that On the first page I display all other user
with checkbox and give user option to select only two user which he
wants to send message. Tell me please how I'll get those checkboxes
value and name on the next page and send message to only those two
selected user.
Thanx in
advance
It's not too hard. In our first page, have something like:

<form name="form1" method="post" action="/page2.php">
<input type="checkbox" name="user[]" value="1">
<input type="checkbox" name="user[]" value="2">
<input type="checkbox" name="user[]" value="3">
<input type="checkbox" name="user[]" value="4">
</form>

In your second page, $_POST['user'] contain the data:

if (isset($_POST['user'])) {
if (count($_POST['user'])) 2) :
echo "Too many users selected!";
}
else {
foreach ($_POST['user'] as $user) {
// validate and handle the data here
}
}
}
else {
echo "No users selected";
}


--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Aug 6 '07 #3
On Aug 6, 9:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
jeet wrote:
Plz help me.Problem is that On the first page I display all other user
with checkbox and give user option to select only two user which he
wants to send message. Tell me please how I'll get those checkboxes
value and name on the next page and send message to only those two
selected user.
Thanx in
advance

It's not too hard. In our first page, have something like:

<form name="form1" method="post" action="/page2.php">
<input type="checkbox" name="user[]" value="1">
<input type="checkbox" name="user[]" value="2">
<input type="checkbox" name="user[]" value="3">
<input type="checkbox" name="user[]" value="4">
</form>

In your second page, $_POST['user'] contain the data:

if (isset($_POST['user'])) {
if (count($_POST['user'])) 2) :
echo "Too many users selected!";
}
else {
foreach ($_POST['user'] as $user) {
// validate and handle the data here
}
}
}
else {
echo "No users selected";
}

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===

A few points that you must keep in mind....

1. If you want to limit the number of selections to the user, one way
you can do this is with JavaScript. In that case, be sure that the use
of Name and Id properties of the checkboxes is ok. For example,
usually the name of a collection of checkboxes is
NAME='checkbox_ name[]' and the id can be ID='checkbox_id _1'. Why?
Because the PHP script take the value of NAME as an array with
$_POST['checkbox_name'], and some function with JavaScript can limit
the number of selected options, using the ID (must be unique!!!!).
Only the selected options are submitting to the PHP script.
2. Be careful, the Radio control only accept one selection.
3. If you are using a Select Multiple control, be sure that you are
selecting every selected option before submitting the information of
the form.

I hope this help.

Sorry for my english.....

Felipe Silva. Chile.

Aug 7 '07 #4
fssm2666 wrote:
On Aug 6, 9:10 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>jeet wrote:
>>Plz help me.Problem is that On the first page I display all other user
with checkbox and give user option to select only two user which he
wants to send message. Tell me please how I'll get those checkboxes
value and name on the next page and send message to only those two
selected user.
Thanx in
advance
It's not too hard. In our first page, have something like:

<form name="form1" method="post" action="/page2.php">
<input type="checkbox" name="user[]" value="1">
<input type="checkbox" name="user[]" value="2">
<input type="checkbox" name="user[]" value="3">
<input type="checkbox" name="user[]" value="4">
</form>

In your second page, $_POST['user'] contain the data:

if (isset($_POST['user'])) {
if (count($_POST['user'])) 2) :
echo "Too many users selected!";
}
else {
foreach ($_POST['user'] as $user) {
// validate and handle the data here
}
}
}
else {
echo "No users selected";
}

--
============== ====
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attg lobal.net
============== ====


A few points that you must keep in mind....

1. If you want to limit the number of selections to the user, one way
you can do this is with JavaScript. In that case, be sure that the use
of Name and Id properties of the checkboxes is ok. For example,
usually the name of a collection of checkboxes is
NAME='checkbox_ name[]' and the id can be ID='checkbox_id _1'. Why?
Because the PHP script take the value of NAME as an array with
$_POST['checkbox_name'], and some function with JavaScript can limit
the number of selected options, using the ID (must be unique!!!!).
Only the selected options are submitting to the PHP script.
And also check it on the server end in case the user has javascript
disabled.
2. Be careful, the Radio control only accept one selection.
Which is why I use checkboxes.
3. If you are using a Select Multiple control, be sure that you are
selecting every selected option before submitting the information of
the form.

I hope this help.

Sorry for my english.....
Your English is better than many Americans!
Felipe Silva. Chile.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Aug 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3965
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 checkboxes are picked up using $_POST and put into session variables. On page two there is another form which is simply a condensed version of the previous one (titles with no descriptions). The checkboxes are named the same on both forms. When...
6
4488
by: middletree | last post by:
I have a page which has something like 100 checkboxes, in three categories, so I chose to build the checkboxes into the page like this: <% strSQL = "SELECT PeopleID, PeopleDesc " strSQL = strSQL & "FROM People " strSQL = strSQL & "ORDER BY PeopleDesc" set rs = conn.execute(strSQL) strTempRow = 0
21
3989
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does nothing in IE. I'd be greatful for any assistance. Also, if I will have problems the code on Opera or Safari, I'd appreciate any pointers--I don't have a Mac to test Safari. THanks very much, Michael
7
5488
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the Repeater control, I've placed DropDownLists and CheckBoxes. When the user has updated the information, he/he clicks the submit button which is outside the scope of the Repeater control.
6
1353
by: Col | last post by:
Hi - I've never worked with list boxes before. Here's what I'd like to do - have a list box (or some other control) that allows multiple selection and stores all the values in one field (can be separated by commas, line breaks - no preference as long as they are all in one field). Can a list box do this? If so, how do I get the selections stored in the field. I've set up the list box with the proper values and multiple selections enabled,...
1
1593
by: g.o.atkins | last post by:
Hi, I've bound an ArrayList to a datagrid and succesfully managed to display the data via an ItemTemplate column and using <%# Container.DataItem %>. The problem I have however is trying to read the value back out of the datagrid. Basically I have checkboxes next to each item in the datagrid - when the user clicks on a button im looping through each item in the datagrid and then trying to read the value out. This works for when a
7
1604
by: jodleren | last post by:
Hi all! I have a problem - I have a list of checkboxes, with certain data... the point is, that some of them are set, and the important thing for mere is to get those values, which have changed from CHECKED to NOT CHECKED. Certain values are marked, once done, the user removes the flags, and I need to know what was set to not being checked anymore (to remove them from the task list).
4
6500
by: TechnoAtif | last post by:
Hi ALL I have entered some array values using checkboxes into mysql database through a form. Next iam creating a searchpage where all those cateogories inserted through checkboxes has to be retrieved using list/menu box. When i check only a single checkbox to insert the checked category ,selecting that category through list box gives out the entire data of the user corresponding to that category. However when i check multiple checkboxes and...
3
1404
by: MikeB | last post by:
I'm trying to do something and I'm sure there is a good technique for it, but I just can't figure it out. I have some member records in a database. I want to display a list of them, and have a checkbox next to each member. One can then click in the checkboxes for one or more members and the next page should then take action on the selected members. I know how to get the members from the database, I know how to create the form to...
0
9423
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
10212
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10047
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...
1
9995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6674
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
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
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.