When I write:
alert(<?php echo "33333";?>);
it works.
If I echo a number, it works too. But if I write
alert(<?php echo "346346gj";?>);
it doesn’t work.
Can someone tell me why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
alert(<?php echo "33333";?>);will outputalert(33333);. And it’s a correct javascript syntax.alert(<?php echo "346346gj";?>);will outputalert(346346gj);. It’s not a correct syntax.When you want to
alerta string in javascript you writealert("346346gj");oralert('346346gj');So you must replace
alert(<?php echo "346346gj";?>);with one of the following:alert('<?php echo "346346gj";?>');alert("<?php echo "346346gj";?>");alert('<?php echo '346346gj';?>');alert("<?php echo '346346gj';?>");alert(<?php echo "'346346gj'";?>');alert(<?php echo '"346346gj"';?>');And there are still different conbinations.