note 29139 rejected from language.variables.predefined by betz
| From: | betz@php.net | Date: | Tue, 04 Feb 2003 12:02:45 +0000 |
| Subject: | note 29139 rejected from language.variables.predefined by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43379@lists.php.net to get a copy of this message | ||
Using PHP, I had some fields that are multiple selection lists and therefore the use of the arrays
within the HTML form is recommended - i.e. name="pets[]" instead of just
name="pets" within the HTML <select....>*.
The problem is that the value appears as "Array".
foreach($_POST as $key=>$this) {
$$key = htmlentities(stripslashes($this),ENT_QUOTES); // handle quotes for subsequent SQL INSERT
if($$key == "Array") { // convert multiple selection array as csv string
$this = implode(', ',$_POST[$key]);
$$key = $this; // assumes clean characters in selection
}
}
Alan Dougall
www.startatthecross.net