Reputation: 353
I have array came from my ajax
$contestant_name_arr = $_GET['contestant_name_arr'];
print_r($contestant_name_arr);
Whenever i try to get the value of each in loop i got error because instead of this
Array ( [0] => value1,value2 )
It should be look like this:
Array (
[0] => value1
[1] => value2
)
How do I separate like that in the example above.
Upvotes: 3
Views: 63
Reputation: 41893
Either devise your url query string to be:
http://yourhost.com?contestant_name_arr[0]=value&contestant_name_arr[1]=value2
Or just simply explode
;
$contestant_name_arr = explode(',', $contestant_name_arr[0]);
Upvotes: 8