Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

[SOLVED]Double quotes in double quotes in single quotes[SOLVED]

I have a little problem here, I'm trying to call a function with a parameter onclick on an echoed button in php. A bit complicated, but look at this:

PHP Code

<?php 
<script>
    function 
say(value){
        
alert(value);
    }
</
script>
<?
php
    
echo'<button onclick="say('test')">Say Test</button>'
?>


This is solved, close the thread.
Just escape the quotes with a backslash:

PHP Code

<?php 
<script>
    function 
say(value){
        
alert(value);
    }
</
script>
<?
php
    
echo'<button onclick="say(\'test\')">Say Test</button>'
?>
PHP Code

<?php 
<script>
    function 
say(value){
  
alert(value);
    }
</
script>
<?
php
    
echo'<button onclick="say(\'test\')">Say Test</button>'
?>

Escape them with a backslash (\)
Ups thanks man, what a quickie. Thanks again, close the thread, solved.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by Aakash_ChoudharyJun 5, 2015 06:12 PM 10 227 Jun 5, 2015 06:12 PM
Last Post: selinux
[PHP] by michael1026Apr 1, 2014 04:11 AM 6 163 Apr 1, 2014 04:11 AM
Last Post: themastersinner