Too easy?
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é
.
Relevant Pages
- Re: How do we get there from here?
... server-side-scripted html. ... This is a simple example with very little php scripting. ... means that the version of the php pre-processor on your web server must ... >>> The browser never sees anything not sent to it by the script. ... (comp.databases.pick) - Re: how to run scripts after a page has already loaded and been sent to a users browser?
... > It's because PHP is a server side scripting language, ... > do stuff before you send stuff to user's web browser. ... As we've discussed on this newsgroup before, if a script starts ... that is after the last HTML is sent to a web browser. ... (alt.php) - Re: How do we get there from here?
... Unlike my dislike for PHP, my dislike for SQL is based on ... >>> up with at least html and php quite mixed into each other, ... Using a PHP script to send HTML ... code to a browser in no way taints that code. ... (comp.databases.pick) - Re: Form Data -> Variables or an Array?
... Forgive me I am a PHP newbie. ... I have a small script that enables me to ... I want to use the HTML formatted form ... variables or an array, so that I can call the data later in the same ... (comp.lang.php) - Re: Form Data -> Variables or an Array?
... Forgive me I am a PHP newbie. ... I have a small script that enables me to ... I want to use the HTML formatted form because ... variables or an array, so that I can call the data later in the same ... (comp.lang.php) |
|