bholls Posted December 20, 2007 Share Posted December 20, 2007 Hi all, I'm having a problem with the following: <select size="<?php echo $size_data[0] ?>" name="keyword_ids[]" tabindex="3" multiple="multiple"> <?php $keyword_query = "SELECT * FROM keywords ORDER BY word ASC"; $keyword_set = mysql_query($keyword_query, $connection); confirm_query($keyword_set); while ($keyword_data = mysql_fetch_array($keyword_set)) { $word_selected = strpos($pg_data['keyword_ids'], $keyword_data["word"]); if ($word_selected == "true") { echo "<option value=\"{$keyword_data["word"]}\"" . " selected"; echo ">{$keyword_data["word"]}</option>"; } else echo "<option value=\"{$keyword_data["word"]}\""; echo ">{$keyword_data["word"]}</option>"; } ?> </select> The keywords for each page are comma seperated. All <option> elements appear to render fine, but only one is selected when I know multiple keywords are present. Can anyone help? Many thanks, Ben Link to comment https://forums.phpfreaks.com/topic/82517-while-loop-with/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.