萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> PHP接受按鈕事件

PHP接受按鈕事件

 <?php
if($submit)
{
if($chkme)
   {
    printf("你選擇了CHECKBOX");
   }
else
   {
    printf("你沒有選擇CHECKBOX");
   }
}
else
{
?>
<html>
<head>
<meta charset="GB2312">
<title>測試提交</title>
</head>
<body>
<form action="<?php echo $PATH_INFO ?>" method=post>
<input type=checkbox checked name="chkme">選我
<input type=submit name=submit value="提交">
</form>
</body>
</html>
<?php
}
?>
<html>
<body>
<form action="xxx.php" onsubmit=“if(!document.getElementById('check').checked){alert('請選擇!');return false;}”>
<input type="checkbox" id="check">
<input type="submit">
</form>
</body>
</html>

copyright © 萬盛學電腦網 all rights reserved