本文介绍了如何将php变量值传递给javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个关于将我的php变量值传递给我的脚本代码的问题。这是我的代码:



Hi guys, I got a problem about pass my php variable value to my script code. Here's my code :

$result=mysql_query("SELECT id_posting FROM posting WHERE id_posting = '$id'",$conn);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
	$id2 = $row['id_posting'];
}

echo "<script>";
echo 'var alertText = alert("Sorry, wrong email or password.");';
echo 'if(alertText != 0)
{
  location = "http://localhost/rb/theme/ide_revolusi.php?posting=$id2"
}';
echo "</script>";





这是我的代码片段。我想我的脚本可以接收名为$ id2的php变量值。但看起来我的脚本没有收到任何东西。任何人,你能帮帮我吗?谢谢。



that's my code snippet. I want to my script can receive my php variable value named $id2. But looks like my script don't receive anything. Anyone, can you help me? Thanks.

推荐答案




这篇关于如何将php变量值传递给javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 05:19