<?php
//validate important input
if ((!$_POST[table_name]) || (!$_POST[num_fields])) {
header( "Location: show_createtable.html");
exit;
}
//begin creating form for display
$form_block = "
<form method=\"post\" action=\"do_createtable.php\">
<input type=\"hidden\" name=\"table_name\" value=\"$_POST[table_name]\">
<table cellspacing=5 cellpadding=5>
<tr>
<th>FIELD NAME</th><th>FIELD TYPE</th><th>FIELD LENGTH</th></tr>";
//count from 0 until you reach the number of fields
for ($i = 0; $i <$_POST[num_fields]; $i++) {
//add to the form, one row for each field
$form_block .= "
<tr>
<td align=center>
<input type=\"text\" name=\"field_name[]\" size=\"30\"></td>
<td align=center>
<select name=\"field_type[]\">
<option value=\"char\">char</option>
<option value=\"date\">date</option>
<option value=\"float\">float</option>
<option value=\"int\">int</option>
<option value=\"text\">text</options>
<option value=\"varchar\">varchar</options>
</select>
</td>
<td align=center>
<input type=\"text\" name=\"field_length[]\" size=\"5\"></td>
</tr>";
}
//finish up the form
$form_block .= "
<tr>
<td align=center colspan=3><input type=\"submit\" value=\"Create Table\"></td>
</tr>
</table>
</form>";
?>
<html>
<head>
<title>Create a Database Table: Step 2</title>
</head>
<body>
<h1>Define fields for <?php echo "$_POST[table_name]"; ?></h1>
<?php echo "$form_block"; ?>
</body>
</html>
and i get this:
//that below is in a box <-not part of the code or anything
\"$_POST[table_name]\ "; //count from 0 until you reach the number of fields for ($i = 0; $i <$_POST[num_fields]; $i++) { //add to the form, one row for each field $form_block .= " "; } //finish up the form $form_block .= "
FIELD NAME FIELD TYPE FIELD LENGTH
box box(with field types in it) box
box(with: \"Create )
"; ?>
Define fields for
That's all i get.
This post has been edited by wolf125: 29 August 2011 - 05:35 PM
Help














