A question about modify button.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
youqing
Forum Newbie
Posts: 1
Joined: Sun Jul 13, 2008 1:54 pm

A question about modify button.

Post by youqing »

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">&nbsp;</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
User avatar
vargadanis
Forum Contributor
Posts: 158
Joined: Sun Jun 01, 2008 3:48 am
Contact:

Re: A question about modify button.

Post by vargadanis »

Can you please put the php code in PHP tags and the HTML into CODE=HTML tags? This will help us to read your code.
Post Reply