bravo14 Posted June 19, 2012 Share Posted June 19, 2012 Hi I am defining a variable that contains commas e.g. "Manchester, United Kingdom" in the following way $location=$_POST['select']; However when I echo the variable, it only shows "Manchester," and ignores anything after the comma, how can I correct this? Probable really simple. Quote Link to comment https://forums.phpfreaks.com/topic/264465-variable-with-commas/ Share on other sites More sharing options...
xyph Posted June 19, 2012 Share Posted June 19, 2012 Are you sure $_POST['select'] contains what you think it does? The behaviour you're describing isn't possible on it's own. <?php $_POST['select'] = 'Manchester, United Kingdom'; $location = $_POST['select']; echo $location; // outputs Manchester, United Kingdom ?> Quote Link to comment https://forums.phpfreaks.com/topic/264465-variable-with-commas/#findComment-1355287 Share on other sites More sharing options...
Barand Posted June 19, 2012 Share Posted June 19, 2012 do you have <option value=Manchester, UK> instead of <option value='Manchester, UK'> Note the quotes. Quote Link to comment https://forums.phpfreaks.com/topic/264465-variable-with-commas/#findComment-1355299 Share on other sites More sharing options...
Pikachu2000 Posted June 19, 2012 Share Posted June 19, 2012 EDIT: Zacly what barand said ^^^ above. Post the form field markup as well. I'm thinking it's a quoting issue. Quote Link to comment https://forums.phpfreaks.com/topic/264465-variable-with-commas/#findComment-1355300 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.