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. 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 ?> 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. 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. Link to comment https://forums.phpfreaks.com/topic/264465-variable-with-commas/#findComment-1355300 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.