gromlok wrote:Thank you for the answer
I'm doing an script in Second Life -LSL is called the language-.
I can not use an array, or list. The only type that i'm allowed to use is string, that's why I send that big string with information with the delimiter, and got this problem!.
I'm not familiar with LSL, but construct the post like this:
Code: Select all
age%5B0%5D=21&age%5B1%5D=68&age%5B2%5D=55&name%5B0%5D=john&name%5B1%5D=peter&name%5B2%5D=steve
%5B is a [ and %5D is a ] with the array index in between %5B
0%5D, %5B
1%5D and so on. So in actuality it is an array like:
Code: Select all
age[0]=21&age[1]=68&age[2]=55&name[0]=john&name[1]=peter&name[2]=steve
There may be some URL/URI encode feature in LSL that will do this or just do it yourself. This is a properly URL encoded string that will be decoded as an array automatically when it hits the receiving page. You can then read the $_POST array in PHP.
Code: Select all
echo $_POST['name'][0]; // john
echo $_POST['age'][0]; // 21
Or in a simpler form as in the first example in my last post it would be:
You can then loop through the $_POST:
Code: Select all
foreach($_POST as $name => $age) {
echo "Name: $name";
echo "Age: $age";
}