[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
相关文档:
最近有一个香港的酒店提出需求,要到酒店业内的商务中心实行计费上网, 提供了如下技术方案:
1、设一台CENTOS5的机器做为路由,把需要计费的机器都设为用此服务器做网关。
2、服务器开启IPTABLE,通过IPTABLE控制能不能使用互联网。
记录下以下技术要点:
一、 php可以通过shell_exec来执行shell指令,但iptables的指令是r ......
原文链接:http://www.phpdo.net/index.php/20100411/56.html
在PHP中使用foreach函数可以遍历数组。Foreach仅能用于数组,语法如下:
Foreach(array as $value) statements
Foreach(array as $key=>$value) statement
第一种语法遍历数组时,每次循环时,当前单元的值被赋给$value,数组内部的指针向前 ......
遍历目录文件,替换编码部分,删除原文件,再重新转码原文件内容,重新生成新文件。
function explorerdir($sDir){
static $aTempArr=array();
$dp=opendir($sDir);
while ($sFileName = readdir($dp)){
if ($sFileName !='.' && $sFileName !='..'){
......
<?php
//声明数组变量
$arr = array('张三','李四','王五','李明');
//foreach循环遍历数组
foreach($arr as $value){
//注意“$value”后必须要一个空格,否则输出的结果不正确
echo "$value<br/>";
}
?> ......