Page 1 of 1

Problems retrieving a post value

Posted: Thu Dec 06, 2007 10:06 pm
by Jhorra
I'm making an ajax call using scriptaculous, and passing it a sortable list via the built in functionality. What it's passing seems to be passed also using the javascript escape function. I'm not sure what happened, but somewhere along the way, all my ajax calls started getting passed that way.

Here is a sample of what's being passed that I captured through firebug:task_list_ul%5B%5D=54&task_list_ul%5B%5D=56&task_list_ul%5B%5D=57&task_list_ul%5B%5D=58

Where you see task_list_ul%5B%5D should be task_list_ul[] because it's going as an array. When I try to grab the post value I get nothing. Before everything started getting passed with the escape function it worked fine grabbing the task_list_ul value, but now I get nothing. I even tried grabbing task_list_ul%5B%5D

Can anyone help me with this?

Posted: Fri Dec 07, 2007 9:09 am
by phpBuddy

Code: Select all

<?php

$str = 'task_list_ul%5B%5D=54&task_list_ul%5B%5D=56&task_list_ul%5B%5D=57&task_list_ul%5B%5D=58';

echo urldecode($str);
/* output:
task_list_ul[]=54&task_list_ul[]=56&task_list_ul[]=57&task_list_ul[]=58
*/
You pass it with a <form method="post"> .... or is it a GET method?
It is not possible to pass an array directly in URL. (possibly you can use a serialized-array-string)
Only single variables with string values.

Posted: Fri Dec 07, 2007 9:57 am
by Jhorra
I figured it out, these were being passed through post.