if ($_POST['Submit']=="Save") {
$template = $_POST['template'];
$resultlink = mysql_query("UPDATE `db_template` SET `template` = `$template` WHERE `tmid` = '1' LIMIT 1 ;");
echo "<html><body><script language=javascript1.1>alert('»зменени¤ сохранены'); window.location='$PHP_SELF';</script><noscript>Your browser doesn't support JavaScript 1.1 or it's turned off in your browsers preferences.</noscript></body></html>";
}
else
{
$resultlink = mysql_query("SELECT * FROM `db_template` LIMIT 0 , 1");
$wrap = mysql_fetch_array($resultlink);
//startHTML();
?>
<table align="center" class="tablewrap" cellpadding="0" cellspacing="3" width="95%">
<tr>
<td class="tdrow2" colspan="2">
<div align="center">
<form name=form1 method=post action=wrapper.php>
<table width=100% border=0>
<tr>
<td width=100%><textarea id="code" name="template" cols="120" rows="30"><?php echo $wrap[template]; ?></textarea></td>
</tr>
<tr>
<td><input type=submit name=Submit value=Save></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>