This is a discussion on Too easy? within the PHP General forums, part of the PHP Programming Forums category; Hello NG! Please have a look at the following lines of code: <html> <head> <script&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello NG!
Please have a look at the following lines of code: <html> <head> <script> function show(what) { alert(what); } </script> </head> <body> <?php $name="Hello 'World'"; echo '<a href="javascript:show(\''.$name.'\')">Test</a>'; ?> </body> </html> The question is: how to safely quote the variable name? Via a build in php or js function? Please note that I know simple write $name="Hello \'World\'"; will solve the problem, but thats not the point here. Thanks in advance René René |