gasma1975 Posted January 27, 2008 Share Posted January 27, 2008 Hi, On page1.php I have a form with a Total value that I POST to page2.php In page2.php I would like to call a javascript function wich will increase the value of TOTAL and display it in HTML But the javascript function is enclosed in a PHP structure. What I tried is (but its not working) <?php echo "VALUE INCREASED = " . '<script type="text/javascript">javafunction($_POST['TOTAL']) </script>' ; ?> thank you for helping, Link to comment https://forums.phpfreaks.com/topic/88057-how-to-pass-a-post-value-to-a-javascript-function/ Share on other sites More sharing options...
taith Posted January 27, 2008 Share Posted January 27, 2008 <script> function yourfunction(i){ alert(i); } yourfunction('<?=$_POST[anything]?>'); </script> Link to comment https://forums.phpfreaks.com/topic/88057-how-to-pass-a-post-value-to-a-javascript-function/#findComment-450577 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.