Re: $POST variables after chopping a delimiter
Posted: Tue Feb 16, 2010 12:11 pm
I'm not sure how you're posting your data, but you can use an array of names instead of using your own delimiters. The method will differ depending on whether you use cURL, fopen() etc. but here is an example with http_post_fields():
Now you can access $_POST['name']['john'] to get the age or if you want them as separate arrays:
Now you can access $_POST['name'][0] and $_POST['age'][0] to get name 'john' and age '21'. Several ways to do it depending upon how you want to access the data in $_POST.
HTH
Code: Select all
$data = array('name'=>array('john'=>21,'peter'=>68,'steve'=>55));
http_post_fields('http://www.example.com/test.php', $data);Code: Select all
$name = array('john','peter','steve');
$age = array(21,68,55);
$data = compact('name', 'age');
http_post_fields('http://www.example.com/test.php', $data);HTH