Session variable is empty

Posted 24 June 2011 - 01:12 AM

i have made an email form, there i set a $_SESSION['res'] variable, when the mail is sent. Then i dump this var. After i dump it, i assign it an empty string. In my page all this code lies in a single page. I am getting a string(0) i.e an empty string in var_dump, although the email is being sent. Kindly see what wrong

Replies To: Session variable is empty

Re: Session variable is empty

Posted 24 June 2011 - 05:33 AM

Assuming that $MyEmail->send() returns true, I don't see anything wrong with it. I notice you have two var_dumps in there... are they both executing? If only one is, then the send() method may be returning either false or 0. You may want to put an echo in there to verify that part of the code is really executing.

Assuming it does, you may wish to try a simple session test separately to see if sessions are working for you at all:

I have dumped the session var before assigning it "" in line#66 so it should contain a value

satis, on 24 June 2011 - 05:33 AM, said:

Assuming that $MyEmail->send() returns true, I don't see anything wrong with it. I notice you have two var_dumps in there... are they both executing? If only one is, then the send() method may be returning either false or 0. You may want to put an echo in there to verify that part of the code is really executing.

Assuming it does, you may wish to try a simple session test separately to see if sessions are working for you at all:

Re: Session variable is empty

Posted 24 June 2011 - 06:28 AM

Why didn't you assign $_SESSION['res'] to contain the error message also. It should be set in both statements in case your if statement doesn't validate to true which is suppose to initialize $_SESSION['res'].
Your next step is verifying that $MyEmail->send() returns true.