Posted January 25, 2012
I have question: how simply execute PHP code depending on JavaScript on/off state?
For example, when no using PHP, this HTML code will work everytime:
For example, when no using PHP, this HTML code will work everytime:
JavaScript is
<script type="text/javascript">
<!--
document.write('on');
//-->
</script><noscript>off</noscript>!
But because of how PHP works script below isn't working at all: <script type="text/javascript">
<!--
document.write('on');
//-->
</script><noscript>off</noscript>!
<script type="text/javascript">
<!--
document.write('<?php $i=1; ?>');
//-->
</script><noscript><?php $i=0; ?></noscript>
JavaScript is <?php if($i==0) echo("off"); else echo("on"); ?>!
I am looking for some simple solution to let such similar scripts work.<!--
document.write('<?php $i=1; ?>');
//-->
</script><noscript><?php $i=0; ?></noscript>
JavaScript is <?php if($i==0) echo("off"); else echo("on"); ?>!
No posts in this topic were marked as the solution yet. If you can help, add your reply