At 10:41 AM -0800 11/4/01, Daniel Harik wrote:
>Hello
>
> I have a class called Member, it has member function called
> vallidateForm(), i try to pass it a $HTTP_POST_VARS array it looks like this:
>
>
>clas Member{
>var $HTTP_POST_VARS;
>function vallidateForm ($HTTP_POST_VARS){
> echo $HTTP_POST_VARS['frmUsername'];
>}
>}
Syntax here is wrong; you don't need to declare function arguments
using var; only class variables need that. I'm uncertain what will
happen if you do this. I would expect that - if PHP's error reporting
were turned up to the maximum - it might give you a warning message.
So do either:
(1) Drop the 'var $HTTP_POST_VARS line;
OR do
(2)
clas Member{
var $HTTP_POST_VARS;
function vallidateForm (){
echo $this->HTTP_POST_VARS['frmUsername'];
}
}
Although option (2) would require rewriting the code below.
Also I assume that the 'clas Member{' line is just a typo, and your
actual code says 'class Member{'...
>$user = new Member;
>if($action=="register"){
>global $HTTP_POST_VARS;
>$user->vallidateForm($HTTP_POST_VARS);
>}else{
>$user->displayForm();
>}
>?>
>
>But i can't acces $HTTP_POST_VARS['frmUsername'] within the function
>
If you are using an old (any PHP3.x, and I think some early betas of
PHP4) version of PHP, you need to turn 'track_vars' on to enable
$HTTP_POST_VARS and other $HTTP_xxx_VARS arrays. If that's the case -
and you can't upgrade immediately - you need to turn track_vars on in
httpd.conf, php.ini, or .htaccess (whatever's appropriate in your
setup).
Hope that helps -
- steve edberg
--
+--- my people are the people of the dessert, ---+
| Steve Edberg [EMAIL PROTECTED] |
| University of California, Davis (530)754-9127 |
| Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ |
+ said t e lawrence, picking up his fork +
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]