problems with seding variables from PHP into JavaScript
Posted: Mon Nov 22, 2004 8:15 am
hi all,
i've such kind of problem... please have a look.
it's rendered when we've no slashes or commas (i.e plain text).
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>