p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 (http://p2p.wrox.com/forumdisplay.php?f=406)
-   -   Possible Error? - CH1 Regiser.php (http://p2p.wrox.com/showthread.php?t=69840)

ArthurDent August 4th, 2008 03:37 AM

Possible Error? - CH1 Regiser.php
 
I've been wrestling with this problem for a while so I downloaded the source code and tried that unmodified. Same problem.

I have the Production Environment flag (common.php) set to false in order to receive error messages. With that set, entering any sort of erroneous input during the registration process in "register.php" will result in the following error:
Code:

Notice: Undefined index: TEMPLATE in ../Wrox_Code/ch_01/public_files/register.php on line 105

Notice: Undefined index: content in ../Wrox_Code/ch_01/public_files/register.php on line 105

Now, line 105 is in this section of the code (the first $GLOBALS line here):
Code:

    // there was invalid data
    else
    {
        $GLOBALS['TEMPLATE']['content'] .= '<div id=Error></div><p><strong>You provided some ' .
            'invalid data.</strong></p> <p>Please fill in all fields ' .
            'correctly so we can register your user account.</p></div>';
        $GLOBALS['TEMPLATE']['content'] .= $form;
    }

    It fails in my code and it fails in the downloaded code from this site and yet I can't for the life of me see anything wrong with it.

Can anyone shed any light on this?

Thanks in advance.

AD


tboronczyk August 10th, 2008 09:13 PM

There is a . that shouldn't be there. Changing .= to = fixes the bug. Line 105 should read:

Code:

$GLOBALS['TEMPLATE']['content'] = '<p><strong>You provided some ' .
     'invalid data.</strong></p> <p>Please fill in all fields ' .
     'correctly so we can register your user account.</p>';



The .= on line 108 is correct.

-Tim

ArthurDent August 12th, 2008 02:50 AM

Ahhh Yesss!

That did it. Thank you very much.

Much appreciated....

AD



All times are GMT -4. The time now is 11:40 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.