indexes and arrays

From: Date: Tue, 05 Jun 2007 15:01:08 +0000
Subject: indexes and arrays
Groups: php.general 
Request: Send a blank email to php-general+get-256097@lists.php.net to get a copy of this message
I have an array of facilities, how do I define them all in one go so I do not get the undefined index error? input name="facilities[5] " type="checkbox" id="facilities[5] " value="Credit Cards Accepted" <?php if ($_POST['facilities'][5]!='') { echo 'checked="checked" '; }?>> Credit Cards Accepted </td> <td><input name="facilities[6] " type="checkbox" id="facilities[6] " value="Towels" <?php if ($_POST['facilities'][6]!='') { echo 'checked="checked" '; }?>> Towels </td> <td><input name="facilities[7] " type="checkbox" id="facilities[7] " value="Luggage Storage" <?php if ($_POST['facilities'][7]!='') { echo 'checked="checked" '; }?>> Luggage Storage </td> <td><input name="facilities[8] " type="checkbox" id="facilities[8] " value="Telephone/Fax Facilities" <?php if ($_POST['facilities'][8]!='') { echo 'checked="checked" '; }?>>

« previous php.general (#256097) next »