note 29139 added to language.variables.predefined

From: Date: Tue, 04 Feb 2003 11:33:45 +0000
Subject: note 29139 added to language.variables.predefined
Groups: php.notes 
Request: Send a blank email to php-notes+get-43375@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 -- http://www.php.net/manual/en/language.variables.predefined.php http://master.php.net/manage/user-notes.php?action=edit+29139 http://master.php.net/manage/user-notes.php?action=delete+29139 http://master.php.net/manage/user-notes.php?action=reject+29139

« previous php.notes (#43375) next »