phpfreak101 Posted July 26, 2006 Share Posted July 26, 2006 Okay.. what do i do in a situation such as this.. Lets say you echo an HTML tag and inside the "onclick event, you want to call a javascript function and pass a variable to it.you end up like this[code]echo "<a href='blah.com' onclick = 'function([/code]Now this is where i'm stuck if i use ' it closes my onclick block of code and if i use " it closes my echo block of code Link to comment https://forums.phpfreaks.com/topic/15642-what-to-do-when-you-run-out-of-parameter-notations-ie-and/ Share on other sites More sharing options...
AndyB Posted July 26, 2006 Share Posted July 26, 2006 escape quotes somewhere in the string, e.g. echo "<a href=\"blah.com\" ... Link to comment https://forums.phpfreaks.com/topic/15642-what-to-do-when-you-run-out-of-parameter-notations-ie-and/#findComment-63772 Share on other sites More sharing options...
Joe Haley Posted July 26, 2006 Share Posted July 26, 2006 [code=php:0]echo <<<ENDThis uses the "here document" syntax to outputmultiple lines with $variable interpolation. Notethat the here document terminator must appear on aline with just a semicolon. no extra whitespace!END;[/code]Will also work.(from the PHP manual) Link to comment https://forums.phpfreaks.com/topic/15642-what-to-do-when-you-run-out-of-parameter-notations-ie-and/#findComment-63773 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.