[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
Ïà¹ØÎĵµ£º
php config
1.°²×°Apache2.2
2.°²×°php5.2(×¢ÒâÑ¡ÔñËùÓеĿâÎļþ)
3.½«phpMyAdmin½âѹ£¬¿½±´ÖÁApache2.2\htdocs\phpmyadmin(¸Ã·¾¶¿ÉÒÔ×ÔÓɸıä)Ï¡£
4.ÐÞ¸ÄÅäÖÃÎļþ£º
1)ÐÞ¸Äphp.ini
¾ßÌå²Ù×÷£º
extension_dir = "C:\Program Files\PHP\ext" (536)
extension=php ......
ÔÚlinuxÏÂͨ¹ýsvn¸üÐÂÁËÒ»¸öphpÎļþ£¬Ä¿µÄÊÇÏëͨ¹ýÖ´ÐÐÕâ¸öÎļþÀ´¶ÁÊý¾Ý²åÈëµ½Êý¾Ý¿â¡£ÔÚÆäÖеļ¸Ì¨Ö´ÐÐûÓÐÎÊÌ⣬ÆäÖÐһ̨¾Í·¢ÏÖÁËCould not open input fileÕâ¸ö´íÎ󣬺óÀ´²éÕÒ×ÊÁϲŷ¢ÏÖÔÀ´ÊÇÎļþ¸ñʽµÄÎÊÌ⣬³ö´íʱÎļþ¸ñʽÊÇdos£¬¿ÉÒÔÔÚviÖÐÓÃ:set ffÀ´²é¿´£¬Èç¹ûÊÇdos¸ñʽ£¬ÄÇôÔòÓÃ:set ff=unixÀ´ÉèÖÃеĸñʽ£¬ÕâÑ ......
<?php
$s = "new string";
//ÏÂÃæË«ÒýºÅ×Ö·û´®ÖеķûºÅ"$"δ×öתÒ壬Òò´Ë$s½«±»Ìæ»»³ÉÆä±äÁ¿µÄÖµ
$str_1 = "Ë«ÒýºÅÖ¸¶¨µÄ×Ö·û´®£¬$s";
//ÏÂÃæË«ÒýºÅ×Ö·û´®ÖеķûºÅ"$"×öÁËתÒ壬Òò´Ë$sÔ·â²»¶¯£¬²»»á±»Ì滻Ϊ±äÁ¿$sµÄÖµ
$str_2 = "Ë«ÒýºÅÖ¸¶¨µÄ×Ö·û´®£¬\$s";
//µ¥ÒýºÅ×Ö·û´®ÖеÄ"$"²»ÓÃ×öתÒå¼´¿ÉÔÑùÊä³ö
$str_3 ......
Óû§¶¨ÒåµÄÀ࣬ҲÊÇѧºÃ PHP Ëù±Ø±¸µÄÌõ¼þÖ®Ò»¡£¶ø PHP µÄÀ࣬ºÍÆäËüµÄÃæÏò¶ÔÏóÓïÑÔ±È½ÏÆðÀ´£¬»¹ËãÂùµ¥´¿µÄ¡£PHP Ö»ÓÐÀà±ð (class)¡¢·½·¨ (method)¡¢ÊôÐÔ¡¢ÒÔ¼°µ¥Ò»¼Ì³Ð (extensions) µÈ¡£¶Ô²»Ï°¹ßʹÓà C++¡¢Java¡¢Delphi µÈÃæÏò¶ÔÏóÓïÑÔÀ´¿ª·¢³ÌÐòµÄÓû§£¬²»·ÁÏÈÔĶÁÒ»ÏÂÓйØÃæÏò¶ÔÏó¸ÅÄîµÄÊ飬ÏàÐÅ¿ÉÒÔ´øÀ´Ðí¶àµÄÊÕ»ñ¡£
......
<?php
//»ñµÃϵͳʱ¼äº¯Êý(×¢Òâ²ÎÊýÖдóдY´ú±íÍêÕûÄê·Ý£¬Ð¡Ð´y´ú±íÄê·Ý¼òд)
$sum = date("Y-m-d");
$sum1 = date("y-m-d");
echo "$sum<br/>";
echo "$sum1<br/>";
//md5¼ÓÃܺ¯Êý
$pass = md5("ÕÅÈý");
......