خرید بک لینک
Hi All,
I am in the process of securing my web pages. Users data is held in a database and I have MySQL queries and procedures to access them and confirm the currently logged on user. I would really like to get some of this data returned to the client side to allow processing within JavaScript. I have tried many solutions that seem to to what I want them to do, but they don't work for me. In fact they looked as if the PHP processing has not been carried out on them.

Here is code at the start of my HTML file:

Code:

<?php
$bool = false;
$num = 3 + 4;
$str = "A string here";
?>

And here is the JavaScript used within the file:

Code:


<script type="text/javascript">
// boolean outputs "" if false, "1" if true
var bool = "<?php echo $bool ?>";

// numeric value, both with and without quotes
var num = <?php echo $num ?>; // 7
var str_num = "<?php echo $num ?>"; // "7" (a string)

var str = "<?php echo $str ?>"; // "A string here"
</script>

All simply return entire string on the right hand side.

For example:

Code:


str_num contains <?php echo $num ?> and not the contents of $num as I would have expected.

Any help would be gratefully received.

Thanks

Jonel

برچسب: نویسنده: آیلین رضوانی تاريخ: جمعه 15 دی 1396 ساعت: 0:26

صفحه بندی