Forums / Setup & design / http variable existance

http variable existance

Author Message

Piotr Switkowski

Friday 19 August 2005 2:00:22 pm

I could not find any way to verify in template, if http variable (POST or GET) exists. So I have to always call ezhttp to retrieve variables and sometimes I am getting an error - variable does not exists.

In fact nothing wrong happens, but this does not look like elegent practise. So could anyone advice how to check if variable exists before calling ezhttp

Arran Price

Sunday 21 August 2005 3:52:02 pm

Hi Piotr,
typically I would check the variable content to make sure its both set and valid (so someone dosent try doing anything malicious) before using it in any operation.
If you do that, then you will already catch errors before trying any operation.

Hope thats of some help.

Arran

Marko Žmak

Monday 22 August 2005 12:31:13 am

I don't think that content can be checked in that way for http variables. Because the values of POST and GET are gathered through an eZ operator, and not via an eZ variable. And it's the operator that genrates an error, and it seems there's no way to check the exsistance of a http variable.

Maybe someone from eZ crew could give us a better answer to this.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

noam s

Monday 05 September 2005 1:24:00 am

maybe you could try checking the parameters before posting the form?

Piotr Switkowski

Monday 05 September 2005 3:01:01 am

Whenever this is possible I make forms to include all parameters. However sometimes it is not possible.

From this discussion I see then that checking the existance of POST vars is not possible

Marko Žmak

Monday 05 September 2005 10:36:47 am

Or you could just ignore the warnings and continue with your life... :)

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth