Re: Check Boxes

From: Date: Wed, 18 Aug 2004 14:52:54 +0000
Subject: Re: Check Boxes
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-35778@lists.php.net to get a copy of this message
Ford, Mike [LSS] wrote:
$chkboxes = $_POST['ch']; $sql = 'SELECT '; foreach($chkboxes as $k => $v) { $sql .= $v; if($k < (sizeof($chkboxes) - 1)) { $sql .= ', '; } } $sql .= ' FROM form';
$sql = 'SELECT ' . implode(', ', $chkboxes) . 'FROM form';
Just note that with either solution, someone can post a value of "* FROM table WHERE 1#" and see everything in any table in your database. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.db (#35778) next »