473,385 Members | 2,015 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,385 software developers and data experts.

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 3294
On Aug 6, 7:15 am, jeet <jatindermash...@gmail.comwrote:
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*******@attglobal.net
==================
Aug 6 '07 #3
On Aug 6, 9:10 am, Jerry Stuckle <jstuck...@attglobal.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...@attglobal.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...@attglobal.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...@attglobal.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*******@attglobal.net
==================
Aug 7 '07 #5

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

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...
6
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 =...
21
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...
7
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...
6
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...
1
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...
7
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...
4
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...
3
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...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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,...
0
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...

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.