Re: undefined function error with lost password script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/03/06, Mark <neretlis@xxxxxxxxxxxxxx> wrote:
> Can anyone see a problem with this at a glance. I think i have pushed my
> luck with this forum ( inc. Chris)of late but i paid a lot of money for this
> script and it has a few bugs.
>
> THis is what i get returned---
> Fatal error: Call to undefined function: recover_pw() in
> /home/realt905/public_html/lost_pw.php on line 70
>
> where line 70 is : recover_pw($_POST['email_address']);
>
>
> ********************************
> <?php
> include("connect.php");
>
> if (isset($_POST['Submit'])) {
>
>   [...]
>  recover_pw($_POST['email_address']);
>
>  function recover_pw($email_address){
>  [...]
>   }

Normally it doesn't matter if you define a function before or after
you use it., but you're defining the function conditionally - if
$_POST['Submit'] isn't set then recover_pw() will not be defined. In
that case you have to make sure it's defined before it's used.

The manual tells you that.

   http://au.php.net/manual/en/language.functions.php

The solution is to take the function definition out if the if-block.

  -robin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux