<?
include('basic_db.php');
?>
<?
if(!$_POST['Update'])
{
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" name="account">
First Name <input name="firstname" type="text" size="25" /><br />
Last Name <input name="lastname" type="text" size="25" /><br />
<input name="user_id" type="hidden" value="11" />
<input name="xxx" type="hidden" value="xxx" />
<input name="yyy" type="hidden" value="www" />
<input name="Update" type="submit" value="Update Data" />
</form>
<?
}
else
{
$db = new Database;
$db->Table_Name('accounts');
$db->Fields($HTTP_POST_VARS);
$db->Submit('Update'); // This is only when the Input submit namded anything other than 'submit'
$db->doPrint(); // This is for debugging purposes to echo the query, so it's optional.
$db->hidden(array('xxx', 'yyy')); // Use this when only incase you have hidden inputs.
$done = $db->Update('user_id'); // user_id is to indicate which row you want to update in the table.
$xxx = $HTTP_POST_VARS;
if($done)
{
echo "your account has been updated";
}
else
{
echo "There was an error updating the data, please check your conncetion information";
}
}
|