Location: PHPKode > projects > HypatiaDB > hypatiadb/tblcreate.php
<?php


include("common_db.php");
include("functions.php");

//$field_number = $_POST['field_number'];
//$tbl_name = $_POST['tbl_name'];


dbconnect($host, $username, $password); //from common_db.php

if(isset($_REQUEST['database'])) {
	$db = $_REQUEST['database'];
} else {
	$db = $_SESSION['current_db'];
}

$strings = loadStrings($lang, 'TBLC1');
headers();
html();
head($strings['TBLC_1_HEADING'], array('js/tblcreate.php', 'js/tblCFuncs.php'));
menu("init();");
navpane();

if($_SESSION['session_user_status'] == 'viewer' || $db == 'HypatiaDB') {
	printAuthError(); die();
}

//$field_number = $_POST['field_number'];

echo('<div id="mainpane">');
printf("<p>$strings[TBLC_1_WELCOME]</p>", htmlspecialchars($_SESSION['current_db']));

//if(!isset($_POST['tbl_name'])) {
	echo '<form onsubmit="return validTblName(this) &amp;&amp; validateForm(this);" method="post" action="tblcreate2.php" class="lblock standalone">';
	echo '<label for="tbl_name">' . $strings['TBLC_1_NAME'] . '<input type="text" name="tbl_name" id="tbl_name" /></label>';
?>

<table class="browse tblc">
	<thead>
		<tr class="firstrow"><th><?php echo($strings['TBLC_12_NAME']); ?></th><th><?php echo($strings['TBLC_12_TYPE']); ?></th><th><?php echo($strings['TBLC_12_LENGTH']); ?></th><th><?php echo($strings['TBLC_12_DEFAULT']); ?></th><th><?php echo($strings['TBLC_12_NULL']); ?></th><th><?php echo($strings['TBLC_12_INDEX']); ?></th><th title="Remove this column">&#0215;</th></tr>
	</thead>
<tbody id="dst">

<tr id="src">
	<td>	<input type="text" name="field0" id="field0" value="id" />					</td>
	<td>	<select name="type0" id="type0" onchange="alterForm(this);">
		<option value="VARCHAR"><?php echo($strings['TBLC_12_TVARCHAR']); ?></option>
		<option value="INTEGER"><?php echo($strings['TBLC_12_TINTEGER']); ?></option>
		<option value="TEXT"><?php echo($strings['TBLC_12_TTEXT']); ?></option>
		<option value="DATE"><?php echo($strings['TBLC_12_TDATE']); ?></option>
		<option value="TIME"><?php echo($strings['TBLC_12_TTIME']); ?></option>
		<option value="DATETIME"><?php echo($strings['TBLC_12_TDATETIME']); ?></option>
		<option value="ENUM"><?php echo($strings['TBLC_12_TENUM']); ?></option>
		<option selected="selected" value="INT UNSIGNED AUTO_INCREMENT"><?php echo $strings['TBLC_12_TAUTO']; ?></option> </select>
		</td>

	<td>	<div id="ld0" style="display: none;"><input type="text" name="length0" id="length0"  value="50" /></div></td>
	<td>	<div id="def0" style="display: none;"><input type="text" name="default0" id="default0" /></div></td>
	<td>	<div id="nul0" style="display: none;"><input type="checkbox" name="null0" value="NULL" checked="checked" /></div></td>
	<td>	<div id="idx0" style="display: none;"><select onclick="checkPri();" name="index0" id="index0">
		<option value="none"><?php echo($strings['TBLC_12_NOIDXTYPE']); ?></option>
		<option value="prime"><?php echo($strings['TBLC_12_PRIMARY']); ?></option>
		<option value="index"><?php echo($strings['TBLC_12_INDEX']); ?></option>
		<option value="unique"><?php echo($strings['TBLC_12_UNIQUE']); ?></option></select></div>	</td>
</tr>
</tbody>
</table>
<?php
	//echo '<p class="warningbox" id="pkwarning">' . $strings['TBLC_1_NOPKWARNING'] . '</p>';
	echo '<input type="hidden" name="database" id="database" value="' . htmlspecialchars($db) . '" />';
	echo '<input type="hidden" name="fieldcount" id="fieldcount" value="1" />';
   
	echo '<hr /><span class="ll" onclick="addField();">' . $strings['TBLC_1_ADDFIELD'] . '</span><br />';
	echo '<input type="submit" value="' . $strings['TBLC_12_SUBMIT'] . '" />';
	echo '</form>';
     
//}

echo('</div>');
endhtml();

?>
Return current item: HypatiaDB