Re: multiple selects and $_POST['vars']

From: Date: Thu, 06 Jun 2002 17:18:47 +0000
Subject: Re: multiple selects and $_POST['vars']
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-100960@lists.php.net to get a copy of this message
> <form method="post" action="blah.php"> > <select multiple name="bleh"> > <option value="1">1</option> > <option value="2">2</option> > <option value="3">3</option> > <option value="4">4</option> > <option value="5">5</option> > </select> > </form> <form method="post" action="blah.php"> <select multiple name="bleh[]"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </form> Notice the [] on the name, telling PHP it's an array. Then, to get the items selected, it will be in $_POST['bleh'], which is an array. So, $_POST['bleh'][0] will be the first one selected, etc. count($_POST['bleh']) will tell you how many were selected. ---John Holmes...

« previous php.general (#100960) next »