Form Data Not saved to Database

shoaib 30 Jun, 2010
Hi,

I have created a form. Now I found difficulty in inserting form data into mysql table.
I already have a table Now I just like to insert into that table. it was working fine with the Autogenerated code but while i make a change in the table it is not working


Can I insert a record in the table using the "insert command" in the "onsubmit code" in form code. if Yes pl send me the Syntax.

Regards,
Heera
GreyHead 30 Jun, 2010
Hi Heera,

If you change the table then you need to 'refresh' the ChronoForms DB Connection. Set the DB Connection to 'No', Apply the form to save it, then set the DB Connection back to Yes and Save again.

Boob
shoaib 01 Jul, 2010
Hi,

I Followed the Steps as U mentioned. But Still the form data is not saved. When I click the submit Button I get The Blank White page. All my menu and page content diappears I get plain page.


I copied the HTML Form code and created a new form and created the table for that form and connected it. I see the same problem as mentioned above.

Regards,
Heera.
🙂
GreyHead 01 Jul, 2010
Hi Heera,

If you see a plain white page then there is a most likely a PHP fatal error.

Please check that you do not have dashes or any other characters except a-z,A-Z,0-9 in your input or column names.

If you set your site Global Error reporting temporarily to Maximum you may get a more useful error message.

Bob
shoaib 01 Jul, 2010
Hi Bob,


Yes I have hyphen's (-) in the input for the fields like date and some other file to seprate the data.

Should I remove all the symbols such as -,/ on the input to save the record?

or Is there any other solution to save the record along with the hypnes and other symbols.

I would be happy if u provide me a solution which supports -,/ symbols as input.

Regards,
Heera
🙂
GreyHead 01 Jul, 2010
Hi Heera,

There is no easy way to use hyphens in ChronoForms input name or column names. (Hyphens in the data are OK.)

The simplest answer is to replace the hyphens with underscores '_'

You need to refresh the DB Connection after any changes to database column names. In the Form Editor click the DB Connection tab and set the Connection to 'No'. Click the 'Apply icon in the toolbar to save the form, open the DB Connection tab, set the Connection back to 'Yes' and re-save the form. This will refresh the copy of the table information that ChronoForms uses.

Bob
shoaib 01 Jul, 2010
Hi Bob,


I have no '-' in the input name. I have it only in the input data.

I tried by removing all the fields which contains the '-' as input data. Still it is not saved to the table.

Is there any other problem?

Regards,
Heera
🤨
GreyHead 01 Jul, 2010
Hi Heera,

If you set your site Global Error reporting temporarily to Maximum you may get a more useful error message.


Bob
shoaib 01 Jul, 2010
Hi Bob,

I get the error like this on the top of the form.

Parse error: syntax error, unexpected '$', expecting T_VARIABLE in /home/osmodels/public_html/subdomains/shoaib4/components/com_chronocontact/chronocontact.php(53) : eval()'d code on line 37



Can u help me to fix this error.


<div class="form_item">
  <div class="form_element cf_heading">
    <h1 class="cf_text">Member Donation</h1>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Select Transaction</label>
    <select class="cf_inputbox" id="select_1" size="1" title=""  name="  select_transaction">
    <option value="">Choose Option</option>
      <?php 
$result = mysql_query( "SELECT fabrik_internal_id,DATE_FORMAT(Transaction_Date,'%m-%d-%Y'),Credit_Amt,Bank_Code FROM Bank_Transaction" )
or die("SELECT Error: ".mysql_error());

while ($line = mysql_fetch_array($result)) 
{
print ("<OPTION value=".$line[0].$line[1].$line[2].$line[3].">$line[0],$line[1] $line[2],$line[3]</OPTION>"); 
}
?>
    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Donation Year</label>
    <select class="cf_inputbox" id="select_2" size="1" title=""  name="Donation_For_Year">
<option value="">Choose Option</option>
    <?php 
$result = mysql_query( "SELECT Project_Year FROM Project_Year" )
or die("SELECT Error: ".mysql_error());

while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line[0].">$line[0]</OPTION>"); }
?>
    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Member</label>
    <select class="cf_inputbox" id="select_3" size="1" title=""  name="Member_ID">
    <option value="">Choose Option</option>
     <?php 
$result = mysql_query( "SELECT First_Name,Last_Name,fabrik_internal_id FROM Member" )
or die("SELECT Error: ".mysql_error());

while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line[0].$line[1].$line[2].">$line[0] $line[1] - $line[2]</OPTION>"); }
?>
    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Referenced By</label>
    <select class="cf_inputbox" id="select_5" size="1" title=""  name="Reference_ID">
    <option value="">Choose Option</option>
      <?php 
$result = mysql_query( "SELECT First_Name,Last_Name,fabrik_internal_id FROM Committee" )
or die("SELECT Error: ".mysql_error());

while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line[0].$line[1].$line[2].">$line[0] $line[1] - $line[2]</OPTION>"); }
?>
    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Subreferenced By</label>
    <select class="cf_inputbox" id="select_6" size="1" title=""  name="Sub_Reference_ID">
    <option value="">Choose Option</option>
     <?php 
$result = mysql_query( "SELECT First_Name,Last_Name,fabrik_internal_id FROM Member" )
or die("SELECT Error: ".mysql_error());

while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line[0].$line[1].$line[2].">$line[0] $line[1] - $line[2]</OPTION>"); }
?>
    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Event Name</label>
    <select class="cf_inputbox" id="select_7" size="1" title=""  name="Event_Name">
    <option value="">Choose Option</option>
      <?php 
$result = mysql_query( "SELECT Event_Name FROM Event" )
or die("SELECT Error: ".mysql_error());

while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line[0].">$line[0]</OPTION>"); }
?>
    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Donated Amount</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_8" name="Donated_Amt" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Amount Type</label>
    <select class="cf_inputbox" id="select_9" size="1" title=""  name="Amt_Type">
    <option value="">Choose Option</option>
    <?php 
$result = mysql_query( "SELECT Amt_Type FROM Amount_Type" )
or die("SELECT Error: ".mysql_error());

while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line[0].">$line[0]</OPTION>"); }
?>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_dropdown">
    <label class="cf_label" style="width: 150px;">Payment Method</label>
    <select class="cf_inputbox" id="select_10" size="1" title=""  name="Payment_Method">
    <option value="">Choose Option</option>
      <?php 
$result = mysql_query( "SELECT Payment_Method FROM Payment_Method" )
or die("SELECT Error: ".mysql_error());

while ($line = mysql_fetch_array($result)) {
print ("<OPTION value=".$line[0].">$line[0]</OPTION>"); }
?>

    </select>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Check Number</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_11" name="CheckNumber" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Donated On</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_12" name="Donated_On" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Email Sent On</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_13" name="Sent_Email_On" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Notes</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_14" name="Notes" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>
<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" name="button_4" type="submit" /><input type="reset" name="reset" value="Reset"/>
  </div>
  <div class="cfclear"> </div>
</div>


And the error which i get after the submission of the form is

Parse error: syntax error, unexpected '$', expecting T_VARIABLE in /home/osmodels/public_html/subdomains/shoaib4/components/com_chronocontact/chronocontact.php(53) : eval()'d code on line 37

Fatal error: Call to a member function bind() on a non-object in /home/osmodels/public_html/subdomains/shoaib4/components/com_chronocontact/libraries/customcode.php(71) : eval()'d code on line 13




Regards,
Heera.
🙂
GreyHead 01 Jul, 2010
Hi Heera,

It's a problem with the database table column names - around the 33 or 34th column.

Bob
shoaib 02 Jul, 2010
Hi,

Thanks It works fine now but I face the porblem in the data. If the input is like "1% Article" only the "1%" is saved to the database.

Regards,
Shoaib.
GreyHead 02 Jul, 2010
Hi shoaib,

That data saves OK in a simple test form here so I guess that there must be something different in the form or code that you are using. Very hard to say any more without seeing it.

Bob
This topic is locked and no more replies can be posted.