A question about modify button.
Posted: Sun Jul 13, 2008 2:00 pm
Hello all:
I tried to make a modify page for the admin to modify the admin to description of the user in the blacklist. but when I click the modify button, the data can be been send into box.
Here is my code. Could some one give me some suggetion. Thanks in advance:
editblacklist.php
<?php
$id = $_GET['id'];
if(isset($_POST['submit'])){
$description = $_POST['description'];
$db->changeDatabase($dataBase, $dbName_games, $dbHost, $dbUser, $dbPasswd);
//modify description
$where = array('id' => array("=", $_GET['id']));
$db->updateTable('blacklist', 'description', $where);
}
//get id
$db->changeDatabase($dataBase, $dbName_games, $dbHost, $dbUser, $dbPasswd);
$where = array('id'=>array("=", $_GET['id']));
$sql=$db->select('blacklist', 'description', $where);
if($sql[0]==true) $row=$sql[1]->fetch(PDO::FETCH_ASSOC);
else echo $db->getError();
$smarty->assign('id', $id);
?>
editblacklist.tpl
<form name="" action="index.php?content=editBlacklist&id={$row.id}" onSubmit="return valida()"method="post" enctype="multipart/form-data">
<div align="left">Modify Description</div>
<table bordercolor="#666666">
<tr>
<td width="148"> </td>
<td width="300"><div align="left"></div></td>
</tr>
<tr>
<td valign="top"><div align="left">Description:</div></td>
<td><div align="left">
<textarea rows="5" cols="20" name="description" id="description" size="200">{$row.description}</textarea>
</div></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Save"></td>
<td><input type="button" name="btnCancel" value="Cancel" onclick="history.back()" /></td>
</tr>
</table>
</form>
This is my testing site:
http://sepeli.sc5.fi/~pei/voittopelit/t ... =blacklist
username:admin
password:admin
I tried to make a modify page for the admin to modify the admin to description of the user in the blacklist. but when I click the modify button, the data can be been send into box.
Here is my code. Could some one give me some suggetion. Thanks in advance:
editblacklist.php
<?php
$id = $_GET['id'];
if(isset($_POST['submit'])){
$description = $_POST['description'];
$db->changeDatabase($dataBase, $dbName_games, $dbHost, $dbUser, $dbPasswd);
//modify description
$where = array('id' => array("=", $_GET['id']));
$db->updateTable('blacklist', 'description', $where);
}
//get id
$db->changeDatabase($dataBase, $dbName_games, $dbHost, $dbUser, $dbPasswd);
$where = array('id'=>array("=", $_GET['id']));
$sql=$db->select('blacklist', 'description', $where);
if($sql[0]==true) $row=$sql[1]->fetch(PDO::FETCH_ASSOC);
else echo $db->getError();
$smarty->assign('id', $id);
?>
editblacklist.tpl
<form name="" action="index.php?content=editBlacklist&id={$row.id}" onSubmit="return valida()"method="post" enctype="multipart/form-data">
<div align="left">Modify Description</div>
<table bordercolor="#666666">
<tr>
<td width="148"> </td>
<td width="300"><div align="left"></div></td>
</tr>
<tr>
<td valign="top"><div align="left">Description:</div></td>
<td><div align="left">
<textarea rows="5" cols="20" name="description" id="description" size="200">{$row.description}</textarea>
</div></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Save"></td>
<td><input type="button" name="btnCancel" value="Cancel" onclick="history.back()" /></td>
</tr>
</table>
</form>
This is my testing site:
http://sepeli.sc5.fi/~pei/voittopelit/t ... =blacklist
username:admin
password:admin