選單處理
接著要處理縣市、鄉鎮選單在選擇項目後能夠做 POST 的動作,方式很簡單就先點選要處理的選單,
然後於『標籤檢視窗 \ 行為』面板中新增『Submit Form』,
『行為』在各個Dreamweaver中的位置有一點小差異。
接著就可以設置所要 POST 的表單,沒什麼好選的,目的就是自己dymenu.php。
php
$i=0;
while($row = mysql_fetch_array($result)) {
if($i%2==0)
$classname="evenRow";
else
$classname="oddRow";
?>
php if(isset($classname)) echo $classname;?>">
php echo $row["userId"]; ?>" >
function setUpdateAction() { document.frmUser.action = "edit_user.php"; document.frmUser.submit(); }
php $rowCount = count($_POST["users"]); for($i=0;$i<$rowCount;$i++) { $result = mysql_query("SELECT * FROM users WHERE userId='" . $_POST["users"][$i] . "'"); $row[$i]= mysql_fetch_array($result); ?>border="0" cellpadding="10" cellspacing="0" width="500" align="center" class="tblSaveForm">
Username
php
$conn = mysql_connect("localhost","root","");
mysql_select_db("phppot_examples",$conn);
if(isset($_POST["submit"]) && $_POST["submit"]!="") {
$usersCount = count($_POST["userName"]);
for($i=0;$i<$usersCount;$i++) {
mysql_query("UPDATE users set userName='" . $_POST["userName"][$i] . "', password='" . $_POST["password"][$i] . "', firstName='" . $_POST["firstName"][$i] . "', lastName='" . $_POST["lastName"][$i] . "' WHERE userId='" . $_POST["userId"][$i] . "'");
}
header("Location:list_user.php");
}
?>
function setDeleteAction() { if(confirm("Are you sure want to delete these rows?")) { document.frmUser.action = "delete_user.php"; document.frmUser.submit(); } }
php
$conn = mysql_connect("localhost","root","");
mysql_select_db("phppot_examples",$conn);
$rowCount = count($_POST["users"]);
for($i=0;$i<$rowCount;$i++) {
mysql_query("DELETE FROM users WHERE userId='" . $_POST["users"][$i] . "'");
}
header("Location:list_user.php");
?>