Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Session with an Incomplete Object
    primarykey
    data
    text
    <p>I'm getting an error I don't know how to fix so I wondering if I could get some help.</p> <p>This is the error</p> <pre><code>Fatal error: process_form() [&lt;a href='function.process-form'&gt;function.process-form&lt;/a&gt;]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &amp;quot;Template&amp;quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /home/twinmeddev/html/template_add.php on line 44 </code></pre> <p>I get this error in the process_form() function. So what I get out of this is that, its thinking I didn't load the class for the template. Which in fact I did up at the top. The include 'inc/item.class.php'; Do I have to re-include it in the function? </p> <p>Here's the code for the particular page with the error. You can see I have everything included like it should be. Where have I gone wrong?</p> <pre><code>&lt;?php include 'inc/prep.php'; include 'inc/header.class.php'; include 'inc/item.class.php'; include 'inc/template.class.php'; include 'inc/formhelper.class.php'; include 'inc/formvalidator.class.php'; include_once( 'inc/config/config.php' ) ; include_once( 'inc/DBE.class.php' ) ; include_once( 'inc/GenFuncs.php' ) ; include_once( 'inc/Search.class.php' ) ; session_start(); //Verify that user is logged in. VerifyLogin($_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING']); if(array_key_exists('_submit',$_POST)) { if($fv_errors = validate_form()) { show_form($fv_errors); } else { process_form(); } } else { // The form wasn't submitted or preview was selected, so display show_form(); } function validate_form(){ } function process_form(){ global $mysqli; echo var_dump($_SESSION); $Template = $_SESSION['template']; $Template-&gt;name = $_POST['name']; $Template-&gt;descript = $_POST['descript']; $Template-&gt;user = $_SESSION['User']; $Template-&gt;customer = $_SESSION['CustID']; $Template-&gt;status = $_POST['status']; $Template-&gt;insert(); //header("Location: template.php"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload