This topic is locked

Getting Unwanted ' ' on updating session variables

6/21/2006 2:28:25 PM
PHPRunner General questions
D
Dale author

I am using the events to update some session variables when the record has been edited.

So if the company name as an example, was changed when saving, the session values would be updated.

$_SESSION["company_name"]= $values["name"];
I am using the above value in the supertop.php to display the company name.

After edit, I get 'ABC Company ltd' displayed. If I log out and back in, the quotes go away.
To questions.

  1. How do I get rid of the quotes without logging out and in.
  2. I would actually like to update the session variables After the record is updated but Im not sure how to structure the code to do this in the After record updated event. It makes more sense to update after someone has Saved the change.
    function BeforeEdit(&$values, $where)

    {
    // Parameters:

    // $values - Array object.

    // Each field on the Edit form represented as 'Field name'-'Field value' pair

    // $where - string with WHERE clause pointing to record to be edited
    //** Custom code ****

    // put your custom code here

    $values["postal_zip_code"]=strtoupper($values["postal_zip_code"]);

    $_SESSION["tax1_id"]= $values["tax1_id"];

    $_SESSION["tax2_id"]= $values["tax2_id"];

    $_SESSION["tax3_id"]= $values["tax3_id"];

    $_SESSION["tax1_rate"]= $values["tax1_rate"];

    $_SESSION["tax2_rate"]= $values["tax2_rate"];

    $_SESSION["tax3_rate"]= $values["tax3_rate"];

    $_SESSION["tax1_reg"]= $values["tax1_reg"];

    $_SESSION["tax2_reg"]= $values["tax2_reg"];

    $_SESSION["tax3_reg"]= $values["tax3_reg"];

    $_SESSION["company_name"]= $values["name"];

    $_SESSION["company_year_start"]= $values["from_date"];

    $_SESSION["company_year_end"]= $values["to_date"];

    return true;
    // return true if you like to proceed with editing this record

    // return false in other case

    }