euel Posted January 3, 2012 Share Posted January 3, 2012 Hi people! I have a form with a select list where options are populated from a table in my db.. the string format is like this -> car - branch (ex. toyota - japan so on..) when viewing the options it displays correctly with the "-" but when i tried submitting the form which will be inserted into the db the "- branch" gets cut off.. i think i need to encode it but i don't know how to do it.. thanks for any reply! Quote Link to comment https://forums.phpfreaks.com/topic/254252-special-character-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 3, 2012 Share Posted January 3, 2012 You are likely missing quotes around the value attribute in your HTML - value = 'toyota - japan' or value = "toyota - japan" Quote Link to comment https://forums.phpfreaks.com/topic/254252-special-character-problem/#findComment-1303588 Share on other sites More sharing options...
euel Posted January 3, 2012 Author Share Posted January 3, 2012 thanks PFMaBiSmAd! i was using a {$value} for the option i didnt realize im missing some single quotes.. can i just ask another question? its related to this.. i have 3 options (ex. toyota - japan, toyota - usa, toyota - europe) and saved each on variable (branch1, branch2, branch3) i tried making it an array with -> explode("," $array) and print them out but the output is like this -> array ([0] => toyota - japan, toyota - usa, toyota - europe) .. which is not the output i want.. is there any other way in doing this? appreciate the reply! thanks again! (im gonna read the php manual for the mean time) Quote Link to comment https://forums.phpfreaks.com/topic/254252-special-character-problem/#findComment-1303595 Share on other sites More sharing options...
scootstah Posted January 3, 2012 Share Posted January 3, 2012 explode() needs a string not an array. Quote Link to comment https://forums.phpfreaks.com/topic/254252-special-character-problem/#findComment-1303596 Share on other sites More sharing options...
euel Posted January 3, 2012 Author Share Posted January 3, 2012 actually scootstah my ex. was a string i just failed to clarify it but thanks for the reply.. anyways ignore my last post cuz i already fixed it, i just made an error in placing a " " for a "," which is stupid thnks! solved! Quote Link to comment https://forums.phpfreaks.com/topic/254252-special-character-problem/#findComment-1303599 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.