PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Talex80
Forum Newbie
Posts: 5 Joined: Tue Nov 09, 2004 7:43 am
Contact:
Post
by Talex80 » Mon Nov 22, 2004 8:15 am
hi all,
i've such kind of problem... please have a look.
Code: Select all
<html>
<head><title>Sample code</title>
</head>
<script language="JavaScript">
function render(text){
document.write(text);
}
</script>
<?
$x = 'input name="save"'; // is not working
$x1 = 'input name="not"'; // is not working
$x2 = 'input name=not'; // working
?>
<body>
<input name="save" id="butt_save" type="button" value="Save as HTML1" onClick="render('<?php echo($x);?>")'>
<br><br><br>
<!--<input name="save" id="butt_save" type="button" value="Save as HTML2" onClick="alert('<?php echo $x1;?>')">-->
</body>
</html>
it's rendered when we've no slashes or commas (i.e plain text).
jollyjumper
Forum Contributor
Posts: 107 Joined: Sat Jan 25, 2003 11:03 am
Post
by jollyjumper » Mon Nov 22, 2004 8:36 am
Hi Talex,
Try \\"not\\" (so not with one \ but two \)
Greetz Jolly.
Talex80
Forum Newbie
Posts: 5 Joined: Tue Nov 09, 2004 7:43 am
Contact:
Post
by Talex80 » Mon Nov 22, 2004 8:44 am
i found... i've to use htmlentities() function
Code: Select all
onClick="render('<?php echo htmlentities($x) ;?>")'>