Yesterday I successfully inserted data using the form1.htm that PHPformgenerator created. Today, I deleted the database that I had used yesterday, because that was just a test database, and I recreated a new database. I got the system to create and insert a table into the database as well as the fields, however, when I type information in the forms1.html page and click the submit button, nothing happens and no data is inserted in the table. Can you please help me out here???
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok first, regarding your "admin portal" question. If you are using the MySQL feature, the code for the MySQL administration in the admin portal is commented out. My mistake, I was testing out the file-based database administration so i had disabled the other one. But the code is there, if you can figure out how to uncomment it :P But don't worry, I'll release a fix by tonight.
For the your second question, can you post the contents of process.php ? I need to see whats going on.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
<br>
<table cellpadding="1" cellspacing="0" border="0" bgcolor="#333333"><tr><td>
<table cellspacing="0" cellpadding="2" bgcolor="cccccc" border="0" width="100">
<tr><td bgcolor="#333333" class="small" align="center">
<b><font color="white">wise words</font></b>
</td></tr>
<tr>
<td class="small" bgcolor="#eeeeee">
What is the difference between genius and stupidity? Genius has limits. - Albert Einstein.
</td>
</tr>
</table>
</td></tr></table>
</td>
</tr>
</table>
</td>
<td rowspan="2" align="right">
<!----Item boxes for daily news events or whatever you want to talk about, i have included three.----->
<table><tr><td>
<table border="0" cellspacing="0" cellpadding="1" bgcolor="#333333"><tr><td>
<table border="0" cellspacing="0" cellpadding="2" bgcolor="#ffcc00" width="380">
<tr>
<td bgcolor="#333333"><font color="#FFFFFF"><b>
Step 3: enter options (if any)</b></font></td>
<td bgcolor="#333333" align="right" class="small">
<font color="#FFFFFF">v2.0</font> </td>
</tr>
<tr>
<td colspan="2" class="small">
if you selected a form field of type drop down
select or radio button, you will now be required to
enter the options for those fields. <br><br>
$errors=0;
$error="The following errors occured while processing your request:<ul>";
//Do Error Checking
for($i=0;$i<sizeof($name);$i++)
{
if($name[$i]=="")
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] The 'Field Name' for field no. ".($i+1)." was left blank.";
}
else
{
if(!eregi('^([a-z]|[0-9]|[" "])*$',$name[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] The 'Field Name' for field no. ".($i+1)." was not valid. Please DO NOT input any special characters like commas, question marks, colons, etc. Only alphanumeric characters are allowed.";
}
}
//Text Box
if($type[$i]=="text")
{
if($size1[$i]!="")
{
if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
}
//Password
if($type[$i]=="password")
{
if($size1[$i]!="")
{
if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
}
//Select Drop Down
if($type[$i]=="select")
{
if($size1[$i]=="")
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Field size must be provided for a field of type 'Drop Down Select'.";
}
else if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
//Radio Button
if($type[$i]=="radio")
{
if($size1[$i]=="")
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Field size must be provided for a field of type 'Radio Button'.";
}
else if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
//Text Area
if($type[$i]=="textarea")
{
if($size1[$i]=="" || $size2[$i]=="")
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Field size 1 and Field size 2 are both required for field of type 'Text Area'.";
}
else if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]) || !ereg("^([1-9]{1})([0-9]{0,2})$",$size2[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
//File Upload
if($type[$i]=="file_upload")
{
if($size1[$i]=="")
{
}
else if(!ereg("^([1-9]{1})([0-9]{0,10})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size. Integers only.";
}
}
}
//Check if any errors occured.
if($errors!=0)
{
echo $error;
}
else
{
echo "<form action='process2.php' method=post>";
for($i=0;$i<sizeof($name);$i++)
{
//If its a Drop Down Select
if($type[$i]=="select")
{
echo "<table width=90%>";
echo "<td><td colspan=2 class='small'>Fields for Drop Down Select: '".$name[$i]."'</td></tr>";
for($j=0;$j<$size1[$i];$j++)
{
echo "<tr><td>Option ".($j+1)."</td><td><input type=text name='select[$i][$j]' size='20'></td></tr>";
}
echo "<input type=hidden name='active[$i]' value='".$j."'>";
echo "</table>";
echo "<br><br>";
}
//If its a radio button
if($type[$i]=="radio")
{
echo "<table width=90%>";
echo "<td><td colspan=2 class='small'>Options for Radio Button: '".$name[$i]."'</td></tr>";
for($j=0;$j<$size1[$i];$j++)
{
echo "<tr><td>Option ".($j+1)."</td><td><input type=text name='radio[$i][$j]' size='20'></td></tr>";
}
echo "<input type=hidden name='active[$i]' value='".$j."'>";
echo "</table>";
echo "<br><br>";
}
no.. i didn't mean that one. i meant the process.php that is "generated". It should be in the "forms" directory, after you create your form with the program.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','1936BizOrderNumber');
pt_register('POST','PurchaserFirstName');
pt_register('POST','PurchaserLastName');
pt_register('POST','DesiredTextinPosition1');
pt_register('POST','DesiredTextinPositon2');
pt_register('POST','DesiredTextinPosition3');
pt_register('POST','DesiredTextinPosition4');
pt_register('POST','DesiredTextinPosition5');
pt_register('POST','DesiredTextinPosition6');
pt_register('POST','TodaysDate');
if($1936BizOrderNumber=="" || $PurchaserFirstName=="" || $PurchaserLastName=="" || $DesiredTextinPosition1=="" || $DesiredTextinPositon2=="" || $DesiredTextinPosition3=="" || $DesiredTextinPosition4=="" || $DesiredTextinPosition5=="" || $DesiredTextinPosition6=="" || $TodaysDate=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="1936 Biz Order Number: ".$1936BizOrderNumber."
Purchaser First Name: ".$PurchaserFirstName."
Purchaser Last Name: ".$PurchaserLastName."
Desired Text in Position 1: ".$DesiredTextinPosition1."
Desired Text in Positon 2: ".$DesiredTextinPositon2."
Desired Text in Position 3: ".$DesiredTextinPosition3."
Desired Text in Position 4: ".$DesiredTextinPosition4."
Desired Text in Position 5: ".$DesiredTextinPosition5."
Desired Text in Position 6: ".$DesiredTextinPosition6."
Todays Date: ".$TodaysDate."
";
mail("qruel@1936.biz","Form Submitted at your website",$message,"From: phpFormGenerator");
$link = mysql_connect("localhost","qruel","1936");
mysql_select_db("watch",$link);
$query="insert into dial21 (OrderNo,FirstName,LastName,Position1,Position2,Position3,Position4,Position5,Position6,Todaydate) values ('".$1936BizOrderNumber."','".$PurchaserFirstName."','".$PurchaserLastName."','".$DesiredTextinPosition1."','".$DesiredTextinPositon2."','".$DesiredTextinPosition3."','".$DesiredTextinPosition4."','".$DesiredTextinPosition5."','".$DesiredTextinPosition6."','".$TodaysDate."')";
mysql_query($query);
header("Refresh: 0;url=http://www.1936.biz/thankyou.htm");
}
?>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Yesterday I successfully inserted data using the form1.htm that PHPformgenerator created. Today, I deleted the database that I had used yesterday, because that was just a test database, and I recreated a new database. I got the system to create and insert a table into the database as well as the fields, however, when I type information in the forms1.html page and click the submit button, nothing happens and no data is inserted in the table. Can you please help me out here???
Ok first, regarding your "admin portal" question. If you are using the MySQL feature, the code for the MySQL administration in the admin portal is commented out. My mistake, I was testing out the file-based database administration so i had disabled the other one. But the code is there, if you can figure out how to uncomment it :P But don't worry, I'll release a fix by tonight.
For the your second question, can you post the contents of process.php ? I need to see whats going on.
I will wait for your patch.
Here is the content of process.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>phpFormGenerator v2.0</title>
<link rel="stylesheet" href="style.css" >
</head>
<body bgcolor="#eeeeee">
<center>
<table cellspacing="20" >
<tr><td>
<!----this is the top navigation bar----->
<table cellspacing="0" cellpadding="1" border="0" bgcolor="333333" ><tr><td>
<table cellspacing="0" cellpadding="1" border="0" bgcolor="cccccc"><tr><td>
<table cellspacing="0" cellpadding="3" border="0" bgcolor="white"><tr><td>
<table cellspacing="0" cellpadding="1" border="0" bgcolor="333333"><tr><td>
<table cellspacing="0" cellpadding="5" border="0" bgcolor="#ff9900" width="510">
<tr>
<td> <p><b>phpFormGenerator</b></p></td>
<td valign="bottom" align="right">
<table border="0" cellspacing="0" cellpadding="1" bgcolor="#333333"><tr><td>
<table height="20" border="0" cellspacing="0" cellpadding="1" bgcolor="#ffcc00">
<tr>
<td class="small"> [
<a href="http://phpformgen.sourceforge.net">home</a> ] [<a href="https://sourceforge.net/project/showfiles.php?group_id=45605">update</a>] [<a href="http://sourceforge.net/docman/?group_id=45605">support</a>] [<a href="mailto:musawir@ali.tf">contact</a>]
</td>
</tr>
</table>
</td></tr></table>
</td>
</tr>
</table>
</td></tr></table>
</td></tr></table>
</td></tr></table>
</td></tr></table>
</td></tr>
<tr><td>
<!----this is the bottom section where all the content goes----->
<table cellspacing="0" cellpadding="1" border="0" bgcolor="333333" ><tr><td>
<table cellspacing="0" cellpadding="1" border="0" bgcolor="cccccc"><tr><td>
<table cellspacing="0" cellpadding="3" border="0" bgcolor="white"><tr><td>
<table cellspacing="0" cellpadding="1" border="0" bgcolor="333333"><tr><td>
<table cellspacing="0" cellpadding="3" border="0" bgcolor="#ff9900" width="510">
<tr>
<td valign="top">
<!----Side Navigation and Links----->
<table>
<tr>
<td>
<table cellpadding="1" cellspacing="0" border="0" bgcolor="#333333"><tr><td>
<table cellspacing="0" cellpadding="2" bgcolor="#333333" border="0" width="100">
<tr><td class="small" align="center">
<font color="#FFFFFF"><b>quick links</b></font>
</td></tr>
<tr>
<td class="small" bgcolor="#ffcc00">
-
<a href="http://sourceforge.net/projects/phpformgen/">project web</a><br>
- <a href="http://www.sourceforge.net/">sourceforge</a><br>
- <a href="http://www.linux.com">linux.com</a><br>
- <a href="http://www.php.net/">php.net</a><br>
- <a href="http://www.mysql.com">mysql.com</a><br>
- <a href="http://www.apache.org">apache.org</a><br>
</td>
</tr>
</table>
</td></tr></table>
</td>
</tr>
<tr>
<td><br>
<table cellpadding="1" cellspacing="0" border="0" bgcolor="#333333"><tr><td>
<table cellspacing="0" cellpadding="2" bgcolor="#333333" border="0" width="100">
<tr><td class="small" align="center">
<font color="#FFFFFF"><b>powered by</b></font>
</td></tr>
<tr>
<td class="small" bgcolor="#ffcc00">
digitalgurus.net<br>
</td>
</tr>
</table>
</td></tr></table>
</td>
</tr>
<tr>
<td>
<br>
<table cellpadding="1" cellspacing="0" border="0" bgcolor="#333333"><tr><td>
<table cellspacing="0" cellpadding="2" bgcolor="cccccc" border="0" width="100">
<tr><td bgcolor="#333333" class="small" align="center">
<b><font color="white">wise words</font></b>
</td></tr>
<tr>
<td class="small" bgcolor="#eeeeee">
What is the difference between genius and stupidity? Genius has limits. - Albert Einstein.
</td>
</tr>
</table>
</td></tr></table>
</td>
</tr>
</table>
</td>
<td rowspan="2" align="right">
<!----Item boxes for daily news events or whatever you want to talk about, i have included three.----->
<table><tr><td>
<table border="0" cellspacing="0" cellpadding="1" bgcolor="#333333"><tr><td>
<table border="0" cellspacing="0" cellpadding="2" bgcolor="#ffcc00" width="380">
<tr>
<td bgcolor="#333333"><font color="#FFFFFF"><b>
Step 3: enter options (if any)</b></font></td>
<td bgcolor="#333333" align="right" class="small">
<font color="#FFFFFF">v2.0</font> </td>
</tr>
<tr>
<td colspan="2" class="small">
if you selected a form field of type drop down
select or radio button, you will now be required to
enter the options for those fields. <br><br>
<!-- The form stuff -->
<?php
// Global registers by pass
include("global.inc.php");
pt_register('POST','fields');pt_register('POST','name');pt_register('POST','type');
pt_register('POST','required');pt_register('POST','size1');pt_register('POST','size2');
// Start regular stuff
$errors=0;
$error="The following errors occured while processing your request:<ul>";
//Do Error Checking
for($i=0;$i<sizeof($name);$i++)
{
if($name[$i]=="")
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] The 'Field Name' for field no. ".($i+1)." was left blank.";
}
else
{
if(!eregi('^([a-z]|[0-9]|[" "])*$',$name[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] The 'Field Name' for field no. ".($i+1)." was not valid. Please DO NOT input any special characters like commas, question marks, colons, etc. Only alphanumeric characters are allowed.";
}
}
//Text Box
if($type[$i]=="text")
{
if($size1[$i]!="")
{
if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
}
//Password
if($type[$i]=="password")
{
if($size1[$i]!="")
{
if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
}
//Select Drop Down
if($type[$i]=="select")
{
if($size1[$i]=="")
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Field size must be provided for a field of type 'Drop Down Select'.";
}
else if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
//Radio Button
if($type[$i]=="radio")
{
if($size1[$i]=="")
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Field size must be provided for a field of type 'Radio Button'.";
}
else if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
//Text Area
if($type[$i]=="textarea")
{
if($size1[$i]=="" || $size2[$i]=="")
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Field size 1 and Field size 2 are both required for field of type 'Text Area'.";
}
else if(!ereg("^([1-9]{1})([0-9]{0,2})$",$size1[$i]) || !ereg("^([1-9]{1})([0-9]{0,2})$",$size2[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size within the range 1-999.";
}
}
//File Upload
if($type[$i]=="file_upload")
{
if($size1[$i]=="")
{
}
else if(!ereg("^([1-9]{1})([0-9]{0,10})$",$size1[$i]))
{
$errors=1;
$error.="<li>[Field No: ".($i+1)."] Please provide a numerical value for Field size. Integers only.";
}
}
}
//Check if any errors occured.
if($errors!=0)
{
echo $error;
}
else
{
echo "<form action='process2.php' method=post>";
for($i=0;$i<sizeof($name);$i++)
{
//If its a Drop Down Select
if($type[$i]=="select")
{
echo "<table width=90%>";
echo "<td><td colspan=2 class='small'>Fields for Drop Down Select: '".$name[$i]."'</td></tr>";
for($j=0;$j<$size1[$i];$j++)
{
echo "<tr><td>Option ".($j+1)."</td><td><input type=text name='select[$i][$j]' size='20'></td></tr>";
}
echo "<input type=hidden name='active[$i]' value='".$j."'>";
echo "</table>";
echo "<br><br>";
}
//If its a radio button
if($type[$i]=="radio")
{
echo "<table width=90%>";
echo "<td><td colspan=2 class='small'>Options for Radio Button: '".$name[$i]."'</td></tr>";
for($j=0;$j<$size1[$i];$j++)
{
echo "<tr><td>Option ".($j+1)."</td><td><input type=text name='radio[$i][$j]' size='20'></td></tr>";
}
echo "<input type=hidden name='active[$i]' value='".$j."'>";
echo "</table>";
echo "<br><br>";
}
}
for($i=0;$i<sizeof($name);$i++)
{
echo "<input type='hidden' name='name[$i]' value='".$name[$i]."'>";
echo "<input type='hidden' name='type[$i]' value='".$type[$i]."'>";
echo "<input type='hidden' name='size1[$i]' value='".$size1[$i]."'>";
echo "<input type='hidden' name='size2[$i]' value='".$size2[$i]."'>";
echo "<input type='hidden' name='required[$i]' value='".$required[$i]."'>";
}
echo "<input type=submit value='next'>";
}
?>
<!-- end stuff -->
</td>
</tr>
</table>
</td></tr></table><br>
</td>
</tr>
<tr>
<td align="right" class="small">opensource design © 2001
</td>
</tr>
</table>
</td> </tr></table>
</td></tr></table>
</td></tr></table>
</td></tr></table>
</td></tr></table>
</td></tr></table>
<A href="http://sourceforge.net"> <IMG src="http://sourceforge.net/sflogo.php?group_id=45605&type=5" width="210" height="62" border="0" alt="SourceForge Logo"></A>
</center>
</body>
</html>
no.. i didn't mean that one. i meant the process.php that is "generated". It should be in the "forms" directory, after you create your form with the program.
I believe this is the correct file that you want.
<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','1936BizOrderNumber');
pt_register('POST','PurchaserFirstName');
pt_register('POST','PurchaserLastName');
pt_register('POST','DesiredTextinPosition1');
pt_register('POST','DesiredTextinPositon2');
pt_register('POST','DesiredTextinPosition3');
pt_register('POST','DesiredTextinPosition4');
pt_register('POST','DesiredTextinPosition5');
pt_register('POST','DesiredTextinPosition6');
pt_register('POST','TodaysDate');
if($1936BizOrderNumber=="" || $PurchaserFirstName=="" || $PurchaserLastName=="" || $DesiredTextinPosition1=="" || $DesiredTextinPositon2=="" || $DesiredTextinPosition3=="" || $DesiredTextinPosition4=="" || $DesiredTextinPosition5=="" || $DesiredTextinPosition6=="" || $TodaysDate=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="1936 Biz Order Number: ".$1936BizOrderNumber."
Purchaser First Name: ".$PurchaserFirstName."
Purchaser Last Name: ".$PurchaserLastName."
Desired Text in Position 1: ".$DesiredTextinPosition1."
Desired Text in Positon 2: ".$DesiredTextinPositon2."
Desired Text in Position 3: ".$DesiredTextinPosition3."
Desired Text in Position 4: ".$DesiredTextinPosition4."
Desired Text in Position 5: ".$DesiredTextinPosition5."
Desired Text in Position 6: ".$DesiredTextinPosition6."
Todays Date: ".$TodaysDate."
";
mail("qruel@1936.biz","Form Submitted at your website",$message,"From: phpFormGenerator");
$link = mysql_connect("localhost","qruel","1936");
mysql_select_db("watch",$link);
$query="insert into dial21 (OrderNo,FirstName,LastName,Position1,Position2,Position3,Position4,Position5,Position6,Todaydate) values ('".$1936BizOrderNumber."','".$PurchaserFirstName."','".$PurchaserLastName."','".$DesiredTextinPosition1."','".$DesiredTextinPositon2."','".$DesiredTextinPosition3."','".$DesiredTextinPosition4."','".$DesiredTextinPosition5."','".$DesiredTextinPosition6."','".$TodaysDate."')";
mysql_query($query);
header("Refresh: 0;url=http://www.1936.biz/thankyou.htm");
}
?>
aah i see your error. Never start a field name with a number. like you did with 1938BizOrder. Always Start with an alphabet letter.