quickstopman Posted April 7, 2008 Share Posted April 7, 2008 what exactly should i do i have a script where ive run out quote options like "" '' \'\' and for some reason \"\" doesn't work what do i do now?! Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/ Share on other sites More sharing options...
The Little Guy Posted April 7, 2008 Share Posted April 7, 2008 huh??? could you explain a little more? Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/#findComment-510958 Share on other sites More sharing options...
quickstopman Posted April 7, 2008 Author Share Posted April 7, 2008 say i have an echo statement: <?php echo "<sometag onclick='somefunction(\'somevalue <thing name= <!-- i need a quote here --> \'+ +\' <!-- and here. --> \')'></sometag>"; ?> \" doesn't work... so what do i do?!? Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/#findComment-510963 Share on other sites More sharing options...
Northern Flame Posted April 7, 2008 Share Posted April 7, 2008 try: <?php echo "<sometag onclick='somefunction(\"somevalue <thing name= "text" \"+ +\" "text" \")'></sometag>"; ?> Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/#findComment-510971 Share on other sites More sharing options...
quickstopman Posted April 7, 2008 Author Share Posted April 7, 2008 nahh the " doesn't work, it interprits it as being a " for somereason =[ anyone else? Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/#findComment-511414 Share on other sites More sharing options...
cooldude832 Posted April 7, 2008 Share Posted April 7, 2008 you can escape quotes in php <?php echo "<a href=\"\" onclick=\"dothis('5')\">Click me</a>"; ?> output <a href="" onclick="dothis('5')">Click me</a> Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/#findComment-511418 Share on other sites More sharing options...
Barand Posted April 7, 2008 Share Posted April 7, 2008 When I find myself in that situation I use a second string <?php $action = "doSomething(\"stringval\")"; echo "<a href='' onclick='$action'>click</a>"; Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/#findComment-511426 Share on other sites More sharing options...
craygo Posted April 7, 2008 Share Posted April 7, 2008 You only need to escape the quotes you start with, so if you start your echo statement with a single quote you need to escape single quotes that are inside. Same goes for double quotes. Ray Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/#findComment-511428 Share on other sites More sharing options...
quickstopman Posted April 7, 2008 Author Share Posted April 7, 2008 thanks guys i fixed it Link to comment https://forums.phpfreaks.com/topic/99927-when-you-run-out-of-quotes/#findComment-511510 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.