Jump to content

PHP echo with Javascript alert


kayz100

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/282290-php-echo-with-javascript-alert/
Share on other sites

  On 9/19/2013 at 6:45 PM, kayz100 said:

 

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>";

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>";
  On 9/20/2013 at 3:44 AM, kayz100 said:

 

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>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.