associative arrays

From: Date: Wed, 28 Jul 2004 19:00:05 +0000
Subject: associative arrays
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-13897@lists.php.net to get a copy of this message
Using QF. Have select element as follows: $sql = "SELECT * FROM $table_name ORDER BY ad_type, orderby "; while ($row = mysql_fetch_assoc($result)) { $adsize_data[ ] = $row['ad_size']; } . . . $form->addElement('select', 'ad_size', 'Select Ad Size:', $adsize_data) ; . . $ad_size = $_GET['ad_size'] ; $sql = "INSERT INTO $table_name ( ad_size) VALUES ( \"$ad_size\")"; So array for selection is for ex. [49][Full Page]. When inserted get 49 into ad_size field, understandable. can "echo $ad_size = $adsize_data[$ad_size]; " Echos "Full Page" correctly. Add $ad_size = $adsize_data[$ad_size]; to code above after $_GET and insert returns empy field ad_size. What am I missing?

« previous php.pear.general (#13897) next »