purplemonkey Posted July 18, 2006 Share Posted July 18, 2006 how are you suposed to use a " in a line of code? example <div class="menutitle" onclick="SwitchMenu('sub1')">Site Menu</div>in PHP would be echo "<div class="menutitle" onclick="SwitchMenu('sub1')">Site Menu</div>" and this would be invalid. but if I did thisecho "<div class='menutitle' onclick='SwitchMenu('sub1')'>Site Menu</div>"then this wouldn't workplease help,I'm working on this code right now.cheers like Link to comment https://forums.phpfreaks.com/topic/14985-help-with/ Share on other sites More sharing options...
hitman6003 Posted July 18, 2006 Share Posted July 18, 2006 Either:[code]echo "<div class=\"menutitle\" onclick=\"SwitchMenu('sub1')\">Site Menu</div>";[/code]or[code]echo '<div class="menutitle" onclick="SwitchMenu(\'sub1\')">Site Menu</div>';[/code] Link to comment https://forums.phpfreaks.com/topic/14985-help-with/#findComment-60192 Share on other sites More sharing options...
purplemonkey Posted July 18, 2006 Author Share Posted July 18, 2006 thats fantastic thank you. ::) it also explains why my editor keeps putting those \'s in when I type ". Was really winding me up that, I had to keep deleting them :D :D Link to comment https://forums.phpfreaks.com/topic/14985-help-with/#findComment-60196 Share on other sites More sharing options...
Dville Posted July 18, 2006 Share Posted July 18, 2006 when I echo html code, that require double quotes, i just use a single quote Link to comment https://forums.phpfreaks.com/topic/14985-help-with/#findComment-60199 Share on other sites More sharing options...
purplemonkey Posted July 18, 2006 Author Share Posted July 18, 2006 think the whole " vs ' was a bit of a red herin, I just noticed that one of my call variables had a case difference, I sorted that, and now everything works as should. Well at least I learnt something new.thank for the aid. ;) Link to comment https://forums.phpfreaks.com/topic/14985-help-with/#findComment-60201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.