note 84684 deleted from function.implode by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 13:20:42 +0000 |
| Subject: | note 84684 deleted from function.implode by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189755@lists.php.net to get a copy of this message | ||
Note Submitter: superstuntguy at gmail dot com
----
I found this pretty useful so I wouldn't have to hardcode things:
<?php
function implode_get() {
$first = true;
$output = '';
foreach($_GET as $key => $value) {
if ($first) {
$output = '?'.$key.'='.$value;
$first = false;
} else {
$output .= '&'.$key.'='.$value;
}
}
return $output;
}
echo '<form action='.$_SERVER['PHP_SELF'].implode_get()'
method=post>';
?>