PHP Classes

Return variable from saveroutine

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  Return variable from saveroutine  >  (Un) Subscribe thread alerts  
Subject:Return variable from saveroutine
Summary:How to return a variable from save routine
Messages:3
Author:ray
Date:2010-03-13 21:26:13
Update:2010-03-14 02:49:29
 

  1. Return variable from saveroutine   Reply   Report abuse  
Picture of ray ray - 2010-03-13 21:26:13
if($doit)
{

//$form->ReadOnly=1;

//Save routine
$idfactuur = save_xmlfactuur($form);
//$form->SetValue($updatedidfactuur, $idfactuur);

}

In this piece of code you have created the opportunity to save submitted form data. Because the function, where this code is at, returns the form object i can't easily return value's retrieved from the save routine. So let's say I want the last inserted ID from the mysql save query, how can I pass this ID back to my mainpage, where I create the forms? I tried to use SetValue/GetValue methods, so I could get the value with $form2->GetValue($variablename,0,0) but that does not work.

The code that is inside my mainpage:

//Maak een nieuw form object dmv functions_forms
$form2 = form_docentenfacturatie_bewaarfactuur($iddocent, $idfactuur, $xmlfactuur);
//Toon form
$form2->StartLayoutCapture();
$body_template="templates/forms/form_body_docentenfacturatie_bewaarfactuur_top.html.php";
require("templates/forms/form_frame_docentenfacturatie_bewaarfactuur_top.html.php");
$form2->EndLayoutCapture();

  2. Re: Return variable from saveroutine   Reply   Report abuse  
Picture of ray ray - 2010-03-13 21:27:48 - In reply to message 1 from ray
it is $idfactuur that I want to pass back to my my mainpage from where i call the function that creates the formobject (and returns it)

  3. Re: Return variable from saveroutine   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2010-03-14 02:49:29 - In reply to message 1 from ray
I am not sure what you want to achieve.

What do you mean by passing the values to the page?

Do you want to create a link to passed the inserted identifier as a parameter to another page, or do you want to pass in in forms?

Anyway, do not use SetValue/GetValue functions. Those are for internal use of the class. That is why they are not documented. If you want to set or get input values, use SetInputValue or GetInputValue.