dselp3944 2012-10-03 12:04
浏览 36

如何在单击图像时运行php代码[重复]

Possible Duplicate:
How do I run PHP code when a user clicks on a link?

I have an image .

<image name="" src="">

I have a php code that needs to be run only after the image has been clicked.

<?php

$var = somthing;
if(condition)
{
    sql stmts;
}

?>

like that.

Both are in the same php page. PLease help me to sort out this problem.

Thanks..

  • 写回答

2条回答 默认 最新

  • duanjia4220 2012-10-03 12:08
    关注

    You can send a request with javascript. With jQuery that would look like this:

    $.get("yourfile.php?function=imageClick", function(data){});
    

    In your php somewhere at the top add:

    if($_GET['function'] == 'imageClick'){
      // do your php stuff
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线