473,382 Members | 1,400 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.

saving array values between pages?

Hello,

I have a series of pages each of which creates an array of values.

How do I keep all the array values until the last page?

Cheers

Geoff
Sep 12 '05 #1
10 3336
Geoff Cox wrote:
Hello,

I have a series of pages each of which creates an array of values.

How do I keep all the array values until the last page?

What do *you* mean by an "array of values"? Example, please.

Mick
Sep 12 '05 #2
Geoff Cox wrote:
Hello,
I have a series of pages each of which creates an array of values.
How do I keep all the array values until the last page?


One could convert those arrays to and from a string
and stash the string in a cookie.

--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Sep 12 '05 #3
On Mon, 12 Sep 2005 21:09:52 GMT, Mick White
<mw***********@rochester.rr.com> wrote:
Geoff Cox wrote:
Hello,

I have a series of pages each of which creates an array of values.

How do I keep all the array values until the last page?
What do *you* mean by an "array of values"? Example, please.


Mick,

The first page will have

array1[0] to array1[7] values

and the second

array2[0] to array2[7] values

etc etc

and I want to have all these sets available on the last page...

Incidentally it would probably make life easier if I could have all
these arrays populated on the same page. At the moment I am having
trouble seeing how to do this. Is it possible to create a table in the
body of the page and use Javascipt to put a series of questions etc
into particular cells?

Cheers

Geoff





Mick


Sep 12 '05 #4
On Mon, 12 Sep 2005 21:15:00 GMT, Dr Clue <ia*********@mindspring.com>
wrote:
Geoff Cox wrote:
Hello,
I have a series of pages each of which creates an array of values.
How do I keep all the array values until the last page?


One could convert those arrays to and from a string
and stash the string in a cookie.


Hello,

any other way?

Cheers

Geoff
Sep 12 '05 #5
Geoff Cox wrote:
On Mon, 12 Sep 2005 21:09:52 GMT, Mick White wrote:
Geoff Cox wrote:
I have a series of pages each of which creates an array of values.
How do I keep all the array values until the last page?


What do *you* mean by an "array of values"? Example, please.


The first page will have
array1[0] to array1[7] values
and the second array2[0] to array2[7] values etc etc.
and I want to have all these sets available on the last page...


Store the array in a hidden form element.

onsubmit='this.form.hiddenFieldName.value=array1.j oin("*")'
// use a separator that will not appear in the array entries (*)

When you submit the form to page 2, the array values will be available
as a string as part of the "get" query, or as part of the "post" info.
What server-side language are you using?
You can use javascript if you want by parsing the query string.
if(location.search){
vals= unescape((location.search.substring(1).replace(/\+/g,""))).split("&");
for(i=0;i<vals.length;i++){
vals[i]=vals[i].split("=")
window[vals[i][0]]=vals[i][1]
}

Now the array values are available as the global variable <hiddenFieldName>
Mick
Sep 12 '05 #6
Geoff Cox wrote:
On Mon, 12 Sep 2005 21:15:00 GMT, Dr Clue <ia*********@mindspring.com>
wrote:
Geoff Cox wrote:
Hello,
I have a series of pages each of which creates an array of values.
How do I keep all the array values until the last page?

One could convert those arrays to and from a string
and stash the string in a cookie.


any other way?


Another way could be a big <iframe> that fills the page , letting the
different pages displayed in the iframe store their arrays in the parent
document.

--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Sep 12 '05 #7
On Mon, 12 Sep 2005 22:24:43 GMT, Mick White
<mw***********@rochester.rr.com> wrote:
Store the array in a hidden form element.

onsubmit='this.form.hiddenFieldName.value=array1. join("*")'
// use a separator that will not appear in the array entries (*)

When you submit the form to page 2, the array values will be available
as a string as part of the "get" query, or as part of the "post" info.
What server-side language are you using?
You can use javascript if you want by parsing the query string.
if(location.search){
vals= unescape((location.search.substring(1).replace(/\+/g,""))).split("&");
for(i=0;i<vals.length;i++){
vals[i]=vals[i].split("=")
window[vals[i][0]]=vals[i][1]
}

Now the array values are available as the global variable <hiddenFieldName>
Mick


Many thanks Mick - will read with care in the morning - need some
sleep now!

Cheers

Geoff

Sep 12 '05 #8
On Mon, 12 Sep 2005 22:33:41 GMT, Dr Clue <ia*********@mindspring.com>
wrote:
Geoff Cox wrote:
On Mon, 12 Sep 2005 21:15:00 GMT, Dr Clue <ia*********@mindspring.com>
wrote:
Geoff Cox wrote:
Hello,
I have a series of pages each of which creates an array of values.
How do I keep all the array values until the last page?
One could convert those arrays to and from a string
and stash the string in a cookie.


any other way?


Another way could be a big <iframe> that fills the page , letting the
different pages displayed in the iframe store their arrays in the parent
document.


I think I am going back to the idea of keeping all the action in one
page!

Cheers

Geoff

Sep 12 '05 #9

"Geoff Cox" <ge*******@notquitecorrectfreeuk.com> wrote in message
news:cj********************************@4ax.com...
Hello,

I have a series of pages each of which creates an array of values.

How do I keep all the array values until the last page?

Cheers


you could
1) use a session
2) store in a cookie
3) pass all the variables from one page to the next via a get or post, each
page accumulating the values for the next page.
4) Create a hidden iframe which has some javascript which holds all these
values.
5) Create a non hidden iframe (like a menu or something else) that does not
get reloaded and store the values there.
6) forget it and as per your other post keep all the action on the same
page.

I actually prefer option 4, followed by 6.

Keeping the action on the same page just means that you need to (bearing in
mind I do not have 100% clear idea of what you are doing)

1) create all the arrays.
2) display the series of questions on the page (I think you wanted one as a
time)
3) store the answers in your arrays
4) post these value to your server.

I think in a seperate post you asked how to display the questions one after
the other ?

you beed a div which is used to display the question. When th euser has
answered the question (click a button i presume) you use innerHTML to
display the next question. or you could display "all" the questions in a
table and then just hide all the unwanted questions.

Sorry for the fragmented answer if there is anything you want some more
details on please just ask !!

Zoe
Sep 13 '05 #10
On Tue, 13 Sep 2005 08:14:37 GMT, "Zoe Brown"
<zo***********@N-O-S-P-A-A-Mtesco.net> wrote:

Zoe,

Many thanks for the detailed answer. Great!

Cheers

Geoff
you could
1) use a session
2) store in a cookie
3) pass all the variables from one page to the next via a get or post, each
page accumulating the values for the next page.
4) Create a hidden iframe which has some javascript which holds all these
values.
5) Create a non hidden iframe (like a menu or something else) that does not
get reloaded and store the values there.
6) forget it and as per your other post keep all the action on the same
page.

I actually prefer option 4, followed by 6.

Keeping the action on the same page just means that you need to (bearing in
mind I do not have 100% clear idea of what you are doing)

1) create all the arrays.
2) display the series of questions on the page (I think you wanted one as a
time)
3) store the answers in your arrays
4) post these value to your server.

I think in a seperate post you asked how to display the questions one after
the other ?

you beed a div which is used to display the question. When th euser has
answered the question (click a button i presume) you use innerHTML to
display the next question. or you could display "all" the questions in a
table and then just hide all the unwanted questions.

Sorry for the fragmented answer if there is anything you want some more
details on please just ask !!

Zoe


Sep 13 '05 #11

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

Similar topics

5
by: Raju V.K | last post by:
I am developing a web site which requires a set og unique values be transferred between pages and server many times. There fore i decided to put the values in an array so that only one reference to...
14
by: Randell D. | last post by:
Folks, Here's my problem: I am createing an array in a file using the reslut of some PHP and MySQL processing. An example of my array would be examlpe="example one"; examlpe="example...
3
by: Mats Boberg | last post by:
Hi, I have problems with saving a bitmap to hdd from my asp.net page I get the following error: "A generic error occurred in GDI+." Code: Bitmap bmp = new Bitmap(240,120);
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
5
by: Keith G | last post by:
VS2003 using VB.Net I want to be able to save drawing path data in a database. If I store the Points array for each GraphicsPath I can then reproduce (in this case) filled polygons at run time....
8
by: Yu SONG | last post by:
Hi all, What would be the most efficient way to save an array of floats to a file (in text format)? At the moment, my code looks like: /* * Saving an array of floats to a file
14
by: Simon | last post by:
I'm trying to write a little function to save data. Basically I have a large 2d array of structs, so I'm going to have to call the save function once per struct in the array. I'd like to save the...
7
by: Bam | last post by:
Hey gang. Is there a way, to automatically save a page that is db driven, as a page that contains html? i would like a page like http://tournamentsbyeck.com/past_standings3.asp to be...
3
by: =?Utf-8?B?ZmJvbGVmZXlzb3Q=?= | last post by:
I have a 'Filter' class that contains some strings, 1 bool and 2 Color attributes. I made an array of Filter : Filter, and I'd like to save this array with the application settings system. here...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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:
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
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.