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

Storing checkbox selections between record paging

Reposted (not sure if got sent)
I have results being displayed each with its own checkbox name
"selected[]" and value "id".

When someone checks a checkbox, and then continues to page through the
data (mysql select), I want that checkbox to be remembered. Basically
I want the user to have multiple selections of checkboxes when paging
through data (recordset), then they click a "continue" button, it
takes all those values which are checked (over all the pages) and does
its thing (insert into a database).

One way I thought of is a JavaScript onClick each time a checkbox is
ticked, it adds it to an array, then uncheck would delete it from that
array. I'm just not sure how I'd get that javascript array through to
PHP. It sounds overly complicated.

Another way is running a query every time a page is loaded. So on the
pageing buttons, I force the form to submit each time, writing that
pages data into a PHP $_SESSION array. But I dont know how to
differentiate when the page buttons are submitting the form or when
the button is submitting the form, and I figured there must be an
easier way.

Kind regards
Jul 17 '05 #1
1 4654
RelaxoRy wrote:
Reposted (not sure if got sent)
I have results being displayed each with its own checkbox name
"selected[]" and value "id".

When someone checks a checkbox, and then continues to page through the
data (mysql select), I want that checkbox to be remembered. Basically
I want the user to have multiple selections of checkboxes when paging
through data (recordset), then they click a "continue" button, it
takes all those values which are checked (over all the pages) and does
its thing (insert into a database).

One way I thought of is a JavaScript onClick each time a checkbox is
ticked, it adds it to an array, then uncheck would delete it from that
array. I'm just not sure how I'd get that javascript array through to
PHP. It sounds overly complicated.
http://mickweb.com/javascript/forms/...kboxArray.html

<script type="text/JavaScript">
onload= function(){
var d=document.forms[0],w=d.length;
while(w--){
if(d[w].type=="checkbox"){
d[w].onclick=function(){
var f=this.form,x=f.length,temp=[];
while(x--){
if(f[x].type=="checkbox" && f[x].checked){
temp.push(f[x].value);
}
}
this.form.hiddenFieldName.value=temp.join(",");
}
}
}
}
</script>

This will be available to your parsing document as comma delimited string.

Mick
Another way is running a query every time a page is loaded. So on the
pageing buttons, I force the form to submit each time, writing that
pages data into a PHP $_SESSION array. But I dont know how to
differentiate when the page buttons are submitting the form or when
the button is submitting the form, and I figured there must be an
easier way.

Kind regards

Jul 17 '05 #2

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

Similar topics

0
by: RelaxoRy | last post by:
I have results being displayed each with its own checkbox name "selected" and value "id". When someone checks a checkbox, and then continues to page through the data (mysql select), I want that...
4
by: Shufen | last post by:
Hi, I'm a newbie that just started to learn python, html and etc. I have some questions to ask and hope that someone can help me on. I'm trying to code a python script (with HTML) to get...
14
by: Luiz Antonio Gomes Pican?o | last post by:
How i can store a variable length data in file ? I want to do it using pure C, without existing databases. I'm thinking to use pages to store data. Anyone has idea for the file format ? I...
1
by: iforsyth | last post by:
Have a paging datagrid with a checkbox control in column(0). ViewState is enabled. I check the checkbox in first row of the grid on a page and then the program hits this event: Private Sub...
2
by: Mark | last post by:
I am attempting to build a repeating list using a repeater control. I want to add a checkbox to each item (line) and 'Select All' and 'Clear All' buttons. I have figured out how to do this...
0
by: Scott P. | last post by:
I'm creating an app using ASP .NET (my second app so bear with me here) that basically builds a PDF file based on a bunch of user selections. I have a page which displays a series of checkboxs...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
2
by: dixonjm | last post by:
I have quite a complicated problem with the above. I will do my best to explain, although I have a word doc (too large to attach here 149KB) with the problem explained full with screen shots if any...
11
by: =?Utf-8?B?UGFyYWcgR2Fpa3dhZA==?= | last post by:
Hi All, I have a large recordset to be displayed on a ASP 3.0 page. I am using recordset paging for this. For the next and previous link i am passing href as <a href=<Page URl>?page=<%=...
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:
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: 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...
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.