xxmart Posted October 10, 2009 Share Posted October 10, 2009 Hi everyone, How can i correctly echo a word with " 's " like in the following example: echo "<option value='men's health'>Test</option>"; This wil work , but it's not valid html. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/177240-solved-echo-problem/ Share on other sites More sharing options...
Glenugie Posted October 10, 2009 Share Posted October 10, 2009 <html> ... <option value="men\'s health">Test</option> ... </html> Just a suggestion that won't involve PHP, if that isn't what your looking for, apologies ~Glenugie~ Quote Link to comment https://forums.phpfreaks.com/topic/177240-solved-echo-problem/#findComment-934535 Share on other sites More sharing options...
mikesta707 Posted October 10, 2009 Share Posted October 10, 2009 try echo "<option value=\"men's health\">Test</option>"; Quote Link to comment https://forums.phpfreaks.com/topic/177240-solved-echo-problem/#findComment-934536 Share on other sites More sharing options...
xxmart Posted October 10, 2009 Author Share Posted October 10, 2009 Thanks both for fast response try echo "<option value=\"men's health\">Test</option>"; Work like a charm Quote Link to comment https://forums.phpfreaks.com/topic/177240-solved-echo-problem/#findComment-934546 Share on other sites More sharing options...
mikesta707 Posted October 10, 2009 Share Posted October 10, 2009 if your topic is solved, there is a topic solved button at the bottom of the page Quote Link to comment https://forums.phpfreaks.com/topic/177240-solved-echo-problem/#findComment-934548 Share on other sites More sharing options...
cags Posted October 10, 2009 Share Posted October 10, 2009 Just to provide an alternative.... echo '<option value="men's health">Test</option>'; Quote Link to comment https://forums.phpfreaks.com/topic/177240-solved-echo-problem/#findComment-934551 Share on other sites More sharing options...
mikesta707 Posted October 10, 2009 Share Posted October 10, 2009 that will give an error. if you want to do that you have to escape the second ' echo '<option value="men's health">Test</option>'; notice the incorrect syntax highlighting echo '<option value="men\'s health">Test</option>'; Quote Link to comment https://forums.phpfreaks.com/topic/177240-solved-echo-problem/#findComment-934552 Share on other sites More sharing options...
cags Posted October 10, 2009 Share Posted October 10, 2009 Yer my bad, I meant to escape it. Guess I should have used syntax highlighting I obviously meant the second version. Quote Link to comment https://forums.phpfreaks.com/topic/177240-solved-echo-problem/#findComment-934556 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.