At the risk of replying to your email with a one word answer, what you need
is JSON.


On Fri, Nov 21, 2008 at 6:37 AM, cali_dotocm <[EMAIL PROTECTED]> wrote:

>
> hi,
> i'm trying to figure out how to pass arrays back and forth from php to
> javascript and back in the zend framework. i need to do this for check
> boxes
> for a project and i canno use zend_form. i came up with a way to do this
> but
> the problem i have is that php cannot read the array string tha i pass to
> it. the javascript i used looks like this:
> [code]var cur="";
>    var ajaxfields="";
>    alert("field count:"+fields.length);
>
>    if (fields.length > 0) {
>
>        for (var t=0;t<fields.length;t++){
>
>
>
> ajaxfields=ajaxfields+escape(fields[t])+"="+escape(document.getElementById(fields[t]).checked)+"&";
>
>        }
>
>        alert("ajaxfields:"+ajaxfields);
>
>        var url="/articles/delete-field"
>        var param="c=delete&"+ajaxfields+"sid="+Math.random();
>        //alert("param");
>        vpMakePostRequest(url, param, deletedone)
>    }
> }[/code]
>
> when i alert the ajaxfields, this is how the string looks like:
>
> ajaxfields:47=false&48=false&49=false&50=true&51=false&52=false&53=false&.
>
> in th php script, i get the c paramemter using(zend):
>
> [code]  $this->c = $_POST['c'];
>                echo $this->c;[/code]
> i echo for debugging purposes and i get "delete".
> now the problem is fetching the array string so i gp-could go ahead with
> the
> script.
> NOTE: i couldn't fetch it the same way.
>
> can anyone help me out
>
>
> --
> View this message in context:
> http://www.nabble.com/fetching-arrays-from-js-in-php-zf-for-checkboxes-tp20610507p20610507.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>

Reply via email to