在html中的按钮单击事件上执行php语句 [英] execute a php statement on button click event in html

查看:285
本文介绍了在html中的按钮单击事件上执行php语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我要在按钮的单击事件上一一显示图像.我正在使用以下代码来获取存储在文件夹中的图像的名称...这部分代码将所有图像显示在页面上.一次显示一张图像,并想在按钮的单击上显示下一张....

代码是

Hi,
I want show images on button''s click event one by one.. i am using following piece of code to get name of images stored in a folder... this piece of code displays all images on a page.. but i want to show one image at a time and want to show next on button''s click....

the code is

<?php

$files = glob("MyPP/*.*");

 for ($i=0; $i<count($files)-1; $i++)

 { $num = $files[$i];
 
//I want to call this statement on button's click event
   echo '<img src="'.$num.'" alt="random image" />'."<br /><br />";

 }

?>



请指导我我该怎么做...

在此先感谢



Please guide me how i do it...

Thanks in advance

推荐答案

文件 = glob(" ); for (


i = 0;


i< count(
i<count(


这篇关于在html中的按钮单击事件上执行php语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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