Hi, I have just started using classes in my programming. The thing that is baffling me (I am not even sure if it is possible) is can I pass a variable value from outside the class script and then use it for that class. e.g. Say I pass a value through a query thread or form field to another script which is written as a class, what sort of coding would I need to do to use this value in variable within that class. Any suggestions would be greatly appreciated.
$object->variable = 'value';
PHP's object-oriented constructs are described here.
If you mean "how do I get variables from a form or querystring when inside an object's method?" the answer is the same as ever: by looking in $POST[] and $GET[].
hiya - this is an old question i've dug up as its relevent to something im doing now. Is it safe to use $POST[] and $GET[] to pass and retrieve sensitive information such as passwords around from one class method to another? or is it indeed the only way of actually getting to the data from a form?
Many thanks for your help
James
Originally posted by j4mes hiya - this is an old question i've dug up as its relevent to something im doing now. Is it safe to use $POST[] and $GET[] to pass and retrieve sensitive information such as passwords around from one class method to another? or is it indeed the only way of actually getting to the data from a form?
$POST[] and $GET[] contain information submitted from POST and GET http requests. That's why the have the names they do. It would be a bit silly to use them for anything else.
alright alright, silly question!! 😉 - its been a frustrating php day. All theyre giving me is undefined index errors and i dont know why!