PHP与JS的问题,急,在线等。。。

sunauqt 2003-08-22 01:57:58
PHP与JS之间怎么嵌套呢?我下面的程序有什么问题吗?
<?php
echo "<script language='javascript'>\n";
echo "choice = greet_form.mobile_address.value;";
echo "for( i = document.greet_form.mobile.length-1; i >= 0; i-- )";
echo "document.greet_form.mobile.options[i] = null;";
$sql = "select fri_mobile from user_address where mobile=\"$reg_mobile\" and groupname="+choice;
$db->sql_query($sql);
$nums = $db->get_query_num();
$j = 0;
while ($result = $db->get_query_result()) {
echo "var opt$j = new Option(\"$result[fri_mobile]\",\"$result[fri_mobile]\")";
echo "for ( var i = 0; i <= $nums-1; i++ ) {";
echo "eval( \"greet_form.mobile.options[i] = opt\" + i );";
echo "if ( i == 0 ) {";
echo "eval( \"greet_form.mobile.options[i].selected = true\" )";
echo "}";
echo "}";
}
echo "</script>";
?>

...全文
58 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunauqt 2003-08-22
  • 打赏
  • 举报
回复
and groupname="+choice;
那这里该怎么写?

如何能取到上面JS里的一个值后传给PHP呢?
kjeny2002 2003-08-22
  • 打赏
  • 举报
回复
$sql = "select fri_mobile from user_address where mobile=\"$reg_mobile\" and groupname="+choice;

这是什么语句。

JSP+JS,哈哈。。二者的语法都用
sunauqt 2003-08-22
  • 打赏
  • 举报
回复
$sql = "select fri_mobile from user_address where mobile=\"$reg_mobile\" and groupname="+choice;


是这条SQL语句有错误了,我把最后的 and groupname="+choice;去掉就对了,为什么?
babystudio 2003-08-22
  • 打赏
  • 举报
回复
看上去没什么,出什么错?

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧