networkthis Posted November 18, 2008 Share Posted November 18, 2008 Ok I have a question. I am autofilling a drop menu from a mysql table. It auto fills great. Prints out all the html properly and everything. However when I try to get the value of the select box... I am only getting the first word everytime.(Most words are single words...but it really screws up my results for searching. Does anyone have any ideas? Here is my code and the ways I have tried to pull the value from the drop menu. <?php $search=mysql_query("SELECT DISTINCT position_type FROM db WHERE status LIKE '%current%' ORDER BY position_type ASC"); while ($row = mysql_fetch_array($search)) { echo '<option value=' . $row[position_type] .'>' . $row[position_type] . '</option>'; } ?> </select> Ways I've tried to $_GET the value of the drop menu...I don't have this problem by the way on anything else besides my drop menus and the form is set to GET. <?php //This only shows one word $position_type; echo $postition_type; //This only shows one word $position_type=$_GET['position_type']; echo $postition_type; //This only shows one word $position_type = @$_GET['position_type'] ; echo $postition_type; //This only shows one word $pt=split(" ",$position_type); echo $pt[0] . "<br>"; echo $pt[1]; ?> The value is always correct when it is only one word. I can't figure it out I'm sure it can't be that difficult, but I'm running out of options. Any ideas are appreciated. Thank you! Link to comment https://forums.phpfreaks.com/topic/133164-solved-_get-variable-multiple-wordonly-one-word-is-showing-up/ Share on other sites More sharing options...
networkthis Posted November 18, 2008 Author Share Posted November 18, 2008 OK.....I solved it!!!!!!!!! Adding this fixed it. <option value="<? echo $row['position_type']; ?>" > Simple huh....only took an hour to figure that out. Link to comment https://forums.phpfreaks.com/topic/133164-solved-_get-variable-multiple-wordonly-one-word-is-showing-up/#findComment-692557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.