kayz100 Posted September 19, 2013 Share Posted September 19, 2013 Hi guys how do I get JavaScript and php doing wonders for me. I want to chnage the following php echo $myInfo; to something like this echo "<script> alert('Your input is correct');</script>"; I am failing to make any changes here please help. I actually want javascript to output the echo $myInfo but don't know how. Thanks a lot Quote Link to comment https://forums.phpfreaks.com/topic/282290-php-echo-with-javascript-alert/ Share on other sites More sharing options...
Solution AbraCadaver Posted September 19, 2013 Solution Share Posted September 19, 2013 (edited) Hi guys how do I get JavaScript and php doing wonders for me. I want to chnage the following php echo $myInfo; to something like this echo "<script> alert('Your input is correct');</script>"; I am failing to make any changes here please help. I actually want javascript to output the echo $myInfo but don't know how. Thanks a lot What about: echo "<script type='text/javascript'>alert('$myInfo');</script>"; Edited September 19, 2013 by AbraCadaver Quote Link to comment https://forums.phpfreaks.com/topic/282290-php-echo-with-javascript-alert/#findComment-1450290 Share on other sites More sharing options...
kayz100 Posted September 20, 2013 Author Share Posted September 20, 2013 Thanks guys but how do I get the php echo working together with alert message? For example using both php echo $myInfo; and echo "<script> alert('Your input is correct');</script>"; maybe something like this but not so good still a newbie echo "<script type='text/javascript'>alert('$myInfo' Your input is correct);</script>"; echo "<script> alert('Your input is correct');</script>"; now where do I put my alert message as well echo "<script type='text/javascript'>alert('$myInfo');</script>"; Quote Link to comment https://forums.phpfreaks.com/topic/282290-php-echo-with-javascript-alert/#findComment-1450346 Share on other sites More sharing options...
AbraCadaver Posted September 20, 2013 Share Posted September 20, 2013 Thanks guys but how do I get the php echo working together with alert message? For example using both php echo $myInfo; and echo "<script> alert('Your input is correct');</script>"; maybe something like this but not so good still a newbie echo "<script type='text/javascript'>alert('$myInfo' Your input is correct);</script>"; echo "<script> alert('Your input is correct');</script>"; now where do I put my alert message as well echo "<script type='text/javascript'>alert('$myInfo');</script>"; echo "<script type='text/javascript'>alert('$myInfo Your input is correct');</script>"; Quote Link to comment https://forums.phpfreaks.com/topic/282290-php-echo-with-javascript-alert/#findComment-1450381 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.