<?php
/*
Butterfly Organizer
Copyright (C) 2007-2008 Butterfly Media Romania
This file is part of Butterfly Organizer.
Butterfly Organizer is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
include('includes/top.php');
echo '<h2>Rename Category</h2>';
if (!isset($submit))
$tablehere = $_GET['tablehere'];
if(isset($_POST['submit'])) {
$tablehere = $_POST['tablehere'];
$tablehere_new = $_POST['tablehere_new'];
$tablehere_new = str_replace(' ','_',$tablehere_new);
mysql_query('RENAME TABLE '.$tablehere.' TO '.$tablehere_new,$database);
redirect();
}
else {
echo "<form method='post' action='category-rename.php?tablehere=tablehere'>";
echo "<table cellspacing='1' cellpadding='2' class='mainTable'>";
echo "<tr><td class='td_title'>Current category name:</td><td class='td_content'><input type='text' name='tablehere' readonly='readonly' value='".$tablehere."' /></td></tr>";
echo "<tr><td class='td_title'>New category name:</td><td class='td_content'><input type='text' name='tablehere_new' /></td></tr>";
echo "</table>";
echo '<div class="menubar"><input type="submit" name="submit" value="Rename Category" class="bsButton" /></div>';
echo "</form>";
}
include('includes/bottom.php');
?>