|
 nasser - 2007-06-20 16:26:38
I am geting the following error msg.
Fatal error: Call to a member function query() on a non-object in C:\Inetpub\vhosts\....\httpdocs\cssForm\class.form.php on line 72
When I edit the $form->action = "$_SERVER['PHP_SELF']";
I get the following error msg:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Inetpub\vhosts\...\httpdocs\myPosa\cssForm\example.php on line 11
Would u pls help.
 Keven Ages - 2007-06-20 18:10:46 - In reply to message 1 from nasser
I've updated the source files, please re-download
The first problem was that the class.mysqldb.php wasn't inluded
Your second problem was simply that you had $_SERVER['PHP_SELF'] within quotes
I've updated the source file to include documentation about leaving the $form->action var blank it will default to $_SERVER['PHP_SELF']
I hope that helps!
 nasser - 2007-06-20 22:52:52 - In reply to message 2 from Keven Ages
I have updated my files and still getting the ff error msg:
Parse error: parse error, unexpected T_SL in C:\Inetpub\vhosts\....\cssForm\example.php on line 16
Here is my example.php file:
<?php
require_once 'class.form.php';
//instantiate our class
$form = new Form;
//what is the table we're attaching to?
$form->tableName = "players";
//where is the processor?
//leave this out if you want the form to point to $_SERVER['PHP_SELF'];
$form->action = "/edit_profile/";
//if you leave the ID field out, it will generate a blank form, uncomment to populate the form with data from the db.
$form->id = <<ENTER_THE_RECORD_ID_YOU_WANT_TO_SEE_IN_THE_FORM>>
//you can customize the submit button for use with ajax etc.
$form->custom_submit = "<a href=\"javascript:void(0);\" onclick=\"javascript:document.players.submit();this.innerHTML='editting...';\">edit
profile</a><br />";
//if you need to hide certain fields in the form
$form->hiddenFields = array('last_login','created_on','team','group');
//now we'll make our form
print $form->insts();
?>
 Keven Ages - 2007-06-21 01:08:00 - In reply to message 2 from Keven Ages
You've uncommented this line:
$form->id = <<ENTER_THE_RECORD_ID_YOU_WANT_TO_SEE_IN_THE_FORM>>
and have not filled the << INSTRUCTION >> area with a value
if you want to generate a blank form leave commented. If you want to edit a form you must give $form->id a value, however you do that is up to you.
 nasser - 2007-06-21 01:17:08 - In reply to message 4 from Keven Ages
with that uncommented, I am getting only link to edit profile and when I clicked it, I get editing msg only.
 Keven Ages - 2007-06-21 14:00:11 - In reply to message 5 from nasser
I think most of the classes on this site are here with the assumption that you have basic PHP knowledge.
I'd suggest you buy yourself a book or go over tutorials on various internet sites before using files from this site.
This class does not claim to 'process' forms, that part is up to you. Once submit is hit you have to add code to do error checking and database submition.
 nasser - 2007-06-21 15:44:02 - In reply to message 6 from Keven Ages
Oh, I thought the class is mainly to generate HTML forms to edit the fields of a record of the specified table? That is what I dont see on the example.php page. I am not seeing any field of the form except the edit profile link.
 Keven Ages - 2007-06-21 19:22:24 - In reply to message 7 from nasser
The only way that would happen is if you didn't load the .sql file into a db.
I've included a die() statement if no table is found (I never thought in a million years someone would do this)
please re-download and try again.
|