[php]how to confirm deleting without using form.
<html>
<head>
<script type="text/javascript">
<!--
function confirmDelete()
{
return confirm("Are you sure you wish to delete this entry?");
}
//-->
</script>
</head>
<body>
<% $var1 = 2;%>
<a href="?action=delete&id=<?=$var1?>" onclick="return confirmDelete();">
Delete this entry
</a>
</body>
</html>
B
TW:
Line 14 is using PHP's short_open_tag which is not recommended, the formal tag should be <%php %>
Line 15 is using ASP-style <% %> tags.
Of couse you can use the PHP formal tag, the above code is simply to demostrate the other two tags.
To enable short_open_tag and "<?" support in php, you need to modify php.ini, make sure enable below two attributes.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag = On
; Allow ASP-style <% %> tags.
; http://php.net/asp-tags
asp_tags = On
相关文档:
集成配置
在配置Eclipse之前,首先需要一个Apache+PHP的基础环境,
可以装wampp或php home,它们都是集成化安装,比较方便,下载地址如下:
wampp2.2
php home
建议装wampp2.2,集成Apache,MySQL,Perl,PHP。而且解压缩就可用,我就用它挺方便的。
下面我就 ......
用户定义的类,也是学好 PHP 所必备的条件之一。而 PHP 的类,和其它的面向对象语言比较起来,还算蛮单纯的。PHP 只有类别 (class)、方法 (method)、属性、以及单一继承 (extensions) 等。对不习惯使用 C++、Java、Delphi 等面向对象语言来开发程序的用户,不妨先阅读一下有关面向对象概念的书,相信可以带来许多的收获。
......
function file_list($path) {
$handle = opendir($path);
if ($handle) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($path."/".$file)) {
echo "<br /><br /><b> ......
<?php
//声明数组变量
$arr = array('张三','李四','王五','李明');
//foreach循环遍历数组
foreach($arr as $key => $value){
//注意“$value”后必须要一个空格,否则输出的结果不正确
echo "值$value 的下标为$key<br/ ......
<?php
//声明数组变量
$arr = array('张三','李四','王五','李明');
//foreach循环遍历数组
foreach($arr as $value){
//注意“$value”后必须要一个空格,否则输出的结果不正确
echo "$value<br/>";
}
?> ......