Code: Select all
<?php
$db_name = $_POST['db_name'];
$table_name = $_POST['table_name'];
$num_fields = $_POST['fields'];
echo $db_name."<br>".$num_fields."<br>".$table_name."<br>";
//retrieving posted hidden values
$num_flds = $_POST['num_flds'];
echo $num_flds."<br>";
if(isset($_POST['create_table_submit']))
{
//how to get the posted values information as those are stored in arrays in the form below
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
if(!empty($num_fields))
{
$form = "<form action='' method='post' name='create_table_form' id='create_table_form' >";
$form.="<table border='0' cellpadding='0' cellspacing='0' width='95%'><tr><td><br />";
$form.="<table border='0' cellpadding='0' cellspacing='0' width='100%'>";
$form.="<tr><td> Database Name:</td>";
$form.="<td><input type='text' name='db_name' size='20' value='$db_name'></td></tr>";
$form.="<tr><td><br> Table Name:</td>";
$form.="<td><br><input type='text' name='table_name' size='20' value='$table_name'>";
$form.="</td></tr>";
for($i=0; $i < $num_fields; $i++)
{
$fld_name = array();
$form.="<tr><font face='verdana' size='1'>";
$form.="<td><br> Field: <input type='text' name='$fld_name[$i]' size='10'>";
$types = array("varchar","tinyint","text","smallint","mediumint","int","bigint","float","double","decimal",
"char","tinyblob","tinytext","blob","mediumblob","mediumtext","longblob","longtext","binary","varbinary");
$form.="<td><br> Type: <select name='fld_type[$i]'>";
for($j=0; $j < count($types); $j++)
{
$form.="<option value=$types[$j]>$types[$j]</option>";
}
$form.="</select></td>";
$form.="<td><br> Size: <input type='text' name='fld_size[$i]' size='5'></td>";
$form.="<td><br> Null: <select name='fld_null[$i]'>";
$form.="<option value='NOT NULL'>Not Null</option>";
$form.="<option value='NULL'>Null</option>";
$form.="</select></td>";
$form.="<td><br><input type='checkbox' name='fld_extra[$i]' value='auto_increment' size='10'> Auto-increment</td>";
$form.="<td><br><input type='radio' name='fld_keys[$i]' value='primary key' size='10'> Primary</td>";
$form.="<td><br><input type='radio' name='fld_keys[$i]' value='unique key' size='10'> Unique</td>";
$form.="</font></tr>";
}
$form.="<tr><td><br> <input type='submit' name='create_table_submit' value='Create Table'></td>";
$form.="<td><input type='hidden' name='num_flds' value=$num_fields /></td>";
$form.="</tr>";
$form.="</table>";
$form.="</td></tr></table>";
$form.="</form>";
echo($form);
}
?>
</body>
</html>I want to retrieve all the posted values from the above form. Any ideas how to go about it... I have been stuck with this from a really long time now...
Any help would be appreciated. Thanks