Hello I need to pass an array of client side events to the next page. Here my user would perform a few events which would be stored in a javascript array, upon completion a submit button would be used to post all that data to the next page.

An example of such a process is listed below, could anyone help me returning that array back to php so that I can post it to the next page. I am trying to populate different entries made into textbox into the array arr. And when I would click the submit button, I want to post that array.

<script type='text/javascript'>

function retText(form)
var x = form.txtBox.value;
var arr = new Array();
 arr[arr.length]= x;
      return arr;

<form name='form' method='post' action=''>
<input type='text' name='txtBox' />
<input type='button' name='click' value='clickme' onclick='retText(this.form)' />
<input type='submit' name='submit' value='submit' />

I want to return that arr back and on post I want to send that array to the next page.

Recommended Answers

All 2 Replies

pass them using post or get then you can access them with php on the page they are submitted to. If your trying to add items before sending then create a hidden field and update that fields value property so whey you submit the information you can access that fields value. If the value is stored as item, item, item you can then use php to separate those fields into an array using the explode function.

<!--load the jquery page here-->


// get the values of the array using jquery from the submit form.  

                var Protocol	= location.protocol;
		var Host		= location.host;
		var Url	= Protocol+"//"+Host+"/nextpage";
		var dataString	= 'arrayvalue='+array;
			type: "POST",
			url: Url,
			data: dataString,
			cache: false,
			success: function(html){
				// tell jquery to do what after succes
				// Here the html which is a view page is loaded into a div having id rightSideContentDiv in the same page.
                return false;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.