调用PHP文件而不使用表单动作 [英] Call PHP file without using form action

查看:70
本文介绍了调用PHP文件而不使用表单动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对PHP很陌生。我做了一点搜索,但没有找到一个好的解决方案。所以在这里发布问题。

I am new to php. I did a little search but did not find a good solution. So posting the question here.

我的网页上有几个缩略图。例如:

I have several thumbnail images in my webpage. Something like:

 <img src="" id="thumb1">
 <img src="" id="thumb2">
 <img src="" id="thumb3">
 <img src="" id="thumb4">

当用户点击任何内容时,我想调用加载php文件这些缩略图图像并将图像的ID传递给php文件。此php文件使用图像ID查询数据库并显示相关信息。到目前为止,我使用表单动作来调用一个php文件。

I want to call load a php file when a user clicks on any of these thumbnail images and pass the id of the image to the php file. This php file queries the database with the image id and displays the relevant information. So far I used "form action" to call a php file.

您可以告诉我如何调用php文件并传递图像ID吗?

Can you please tell me how to call php file and pass the image id?

谢谢。

Thanks.

推荐答案

您可以尝试Angualr Js。在角度js中,我们可以在不提交的情况下获取表单元素属性。所以你可以使用角度js来点击图片ID。您可以传递相同内容以获取所需的php页面。

You can try Angualr Js. In angular js we can the get the form elements attributes without submitting. So you can get the image id's on clicking using angular js. You can pass the same to get your required php page.

这篇关于调用PHP文件而不使用表单动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆