NYCPHP Meetup

NYPHP.org

[nycphp-talk] How to pass on variables with POST without using a form

Cliff Hirsch cliff at pinestream.com
Wed Sep 20 23:31:24 EDT 2006


Why not just use the built-in function http_build_query? 
-------
The easiest way I've found to do this is as follows:

$myvars = array(
  'item1' => 'value1',
  'item2' => 'value2',
);

$postdata = array();
foreach ($myvars as $k => $v) {
  $postdata[] = urlencode($k) .'=' . urlencode($v);
}
$postdata = implode('&',$postdata);





More information about the talk mailing list