Example:

javascript:

var mycourses=new Array(); 
mycourses[0]="History";       
mycourses[1]="Math";
mycourses[1][0]="Introduction to math";
mycourses[1][1]="Math 2";
mycourses[1][2]="Math 3";

PHP will then run these values through functions (please note values are mostly not strings as in the example above but rather numbers), the functions will return some text which will than be displayed in a form

How should I go about doing this?

p.s.: I found some similar stuff, but nothing quite like this... as far as I see I will have to use JSON (is there a way to code it from JS automatically - saw this for strings) and AJAX

share|improve this question
feedback

2 Answers

Yes, you may use JSON and PHP's json_encode() and json_decode() functions for that.

share|improve this answer
feedback

There are libraries in JavaScript... that will automatically convert your Array to JSON, and in php there are function to convert from JSON to a PHP Array... you process encode again in PHP and decode in JS...

JSON is an standard for JS.. try to use it since most languages already offer support for it, and it would make your life easier

share|improve this answer
and these librarys are...? – Constructor Apr 16 '10 at 17:20
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.