savagenoob Posted November 18, 2011 Share Posted November 18, 2011 I am passing an array to an option list but if a value has two words, the second word doesnt get sent via POST. So if the value should be THE ONE, the word ONE doesnt get sent via POST. Kinda wierd, wondered if there is an easy explanation for this? <?php echo '<SELECT name=carrier>'; foreach ($allcar as $key => $value) { echo '<OPTION value=' . $value . '> ' . $value . ''; } echo '</select>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/251351-passing-array-to-option-list-help/ Share on other sites More sharing options...
phporcaffeine Posted November 18, 2011 Share Posted November 18, 2011 All HTML option tags, like most other HTML tags, must be closed (i.e <option value=''></option>) Quote Link to comment https://forums.phpfreaks.com/topic/251351-passing-array-to-option-list-help/#findComment-1289185 Share on other sites More sharing options...
savagenoob Posted November 18, 2011 Author Share Posted November 18, 2011 I know that, but thats not the issue at hand. It is correct on my side but the second word is still getting truncated. Quote Link to comment https://forums.phpfreaks.com/topic/251351-passing-array-to-option-list-help/#findComment-1289189 Share on other sites More sharing options...
Pikachu2000 Posted November 18, 2011 Share Posted November 18, 2011 The value= attribute needs to be quoted. Quote Link to comment https://forums.phpfreaks.com/topic/251351-passing-array-to-option-list-help/#findComment-1289190 Share on other sites More sharing options...
savagenoob Posted November 18, 2011 Author Share Posted November 18, 2011 Doh... :'( Quote Link to comment https://forums.phpfreaks.com/topic/251351-passing-array-to-option-list-help/#findComment-1289191 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.