dpz90118 2012-09-28 15:40
浏览 20
已采纳

PHP和JavaScript数组附件

I have the following problem:

onclick=langedit('".$carray2['example']."','".$carray2['id']."')

$carray2['example'] is a string containing "ABOUT US" with space, and this is the output in HTML:

onclick='langedit('Contact" us','9')="">

My PHP code :

else {
$cquery2 = mysql_query ("SELECT id,example,".$startlan." FROM language WHERE example = '$word'");
$carray2 = mysql_fetch_array($cquery2);
if($carray2[$startlan] == '') {
if($_SESSION['view'] == 'admin' && isset($_SESSION['siteshow'])){
echo  "<span class='langedit' id='langedit".$carray2['id']."' onclick=langedit('".$carray2['example']."','".$carray2['id']."')><img src='images/sys/edit.png' > </span>";
return $carray2['example'];
}else{
return $carray2['example'];
}
}

I don't know what's happening, the langedit function does not work because of this.

  • 写回答

1条回答 默认 最新

  • duanhuan2301 2012-09-28 16:01
    关注

    Cover the langedit call on onclick with double quotes

    onclick=\"langedit('".$carray2['example']."','".$carray2['id']."')\"
    

    Otherwise if $carray2['example'] is About Us, the onclick attribute becomes onclick=langedit('About which is an invalid function call.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端