<?php
include "common.php";
head();
?>
                <!--/span-->
                <div class="span9" id="content">

                    <div class="row-fluid">
                        <!-- block -->
                        <div class="block">
                            <div class="navbar navbar-inner block-header">
                                <div class="muted pull-left">Edit Admin</div>
                            </div>
                            <div class="block-content collapse in">
                                <div class="span12">
<?php
$sql = "SELECT * FROM admin WHERE id = '1'";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($result);
echo '
<form action="" method="post">
<p>
	<label>Name</label>
	<input name="name" type="text" value="' . $row['name'] . '">
</p>
<p>
	<label>Password</label>
	<input name="password" type="password" value="' . $row['password'] . '">
</p>
<p>
	<label>E-Mail</label>
	<input name="mail" type="text" value="' . $row['mail'] . '">
</p>
<br><input type="submit" class="btn red" name="edit" value="Edit"/>
</form>
';
if ($_POST['edit']) {
    $name     = htmlspecialchars($_POST['name']);
    $password = htmlspecialchars($_POST['password']);
    $mail     = htmlspecialchars($_POST['mail']);
    $edit     = "UPDATE admin SET name='$name', password='$password', mail='$mail' WHERE id='1'";
    $sql      = mysql_query($edit);
    echo '
	<br /><center>Update of the admin information was successful</center><br />
	<meta http-equiv=Refresh content=3;url=admin.php>';
}
?>
                                </div>
                            </div>
                        </div>
                        <!-- /block -->
                    </div>
   
<?php
footer();
?>