i've used the same forms on two other times as admin forms to create tables in a mysql database, but this time, the "table_name" variable seems to be combining with the other variables to make one large URL-type variable list.
the first form is such:
<FORM METHOD="post" ACTION="set_fields.php">
<P CLASS="item">Table Name:<BR>
<INPUT TYPE="text" NAME="table_name" SIZE=30></P>
<P CLASS="item">Number of Fields:<BR>
<INPUT TYPE="text" NAME="num_fields" SIZE=5></P>
<P><INPUT TYPE="submit" NAME="submit" VALUE="Go to Step 2"></P>
</FORM>
the next part that processes the form, the 'set_fields.php':
<?
if ((!$table_name) || (!$num_fields)) {
header( "Location: URL-HERE/admin/make_table.php");
exit;
}
$form_block = "
<FORM METHOD=\"post\" ACTION=\"do_make_table.php\">
<INPUT TYPE=\"hidden\" NAME=\"table_name\" VALUE=\"$table_name\">
<TABLE CELLSPACING=5 CELLPADDING=5 BORDER=0>
<TR>
<TH CLASS=\"item\">Field Name</TH>
<TH CLASS=\"item\">Field Type</TH>
<TH CLASS=\"item\">Field Length</TH>
<TH CLASS=\"item\">Primary Key?</TH>
<TH CLASS=\"item\">Auto-Increment?</TH>
</TR>
";
for ($i = 0; $i < $num_fields; $i++) {
$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=\"time\">time</OPTION>
<OPTION VALUE=\"float\">float</OPTION>
<OPTION VALUE=\"int\">int</OPTION>
<OPTION VALUE=\"text\">text</OPTION>
<OPTION VALUE=\"varchar\">varchar</OPTION>
<OPTION VALUE=\"blob\">blob</OPTION>
</SELECT>
</TD>
<TD ALIGN=center><INPUT TYPE=\"text\" NAME=\"field_length[]\" SIZE=\"5\"></TD>
<TD ALIGN=center><INPUT TYPE=\"checkbox\" NAME=\"primary[]\" VALUE=\"Y\"></TD>
<TD ALIGN=center><INPUT TYPE=\"checkbox\" NAME=\"auto_increment[]\" VALUE=\"Y\"></TD>
</TR>
";
}
$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>
<LINK REL="stylesheet" TYPE="text/css" HREF="admin_styles.css">
</HEAD>
<BODY>
<P CLASS="pagetitle">Define Fields for <? echo "$table_name"; ?></P>
<? echo "$form_block"; ?>
</BODY>
</HTML>
for some reason or another the $table_name variable is passed as something like:
Step 1: Name and Number
headlines&num_fields=5&submit=Go+to+Step+2
5
if headlines was inputted as the name and 5 the number of fields..
i know this is a little long, but i don't want to be missing any info anyone might need to answer this. if anyone ccould spot it, it would be an immense problem. i've been staring at it for a couple hours now, and i can't find the problem.
thanks !!