| 
	
 | 
 Posted by Mr. Newt on 01/01/07 16:21 
"J.O. Aho" <user@example.net> wrote in message  
news:4vsc6bF1be69iU1@mid.individual.net... 
> Mr. Newt wrote: 
>> Hi y'all, 
>> 
>> I'm new to PHP and found a script on about.com that is supposed to make  
>> an address book.  Doesn't work (for me) though.  First thing I noticed is  
>> that a variable ($mode) is not declared.  When I do declare it, the  
>> script still doesn't work properly. 
>> 
>> Note:  The database and table exists with 2 rows, which shows up on the  
>> address book page, so I'm reasonably sure it's not a MySQL issue. 
> 
> No, it's not an MySQL issue, it's an ancient script you found, that  
> depends on the deprecated GLOBAL setting. 
> 
> There are three ways to fix this, one good and two less good 
> 
> 1. Edit your php.ini and sett the following value 
>    register_globals = On 
> 
> 2. Use the following on top of on pages php section: 
>    foreach($_GET as $key=>$value){ 
>      $$key=$value; 
>    } 
> 
> 3. Manually set values (best way in the long run), add this to top of the  
> pages php section: 
>    $mode=$_POST['mode']; 
>    $name=$_POST['name']; 
>    $phone=$_POST['phone']; 
>    $email=$_POST['email']; 
>    $id=$_POST['id']; 
> 
> 
> --  
> 
>   //Aho 
 
Thanks guys.  When I tried # 3 above, the error "Undefined index: mode"  
popped up. 
When I tried # 2, the error was "Undefined variable: mode."  The remove  
function worked though.  =) 
#1 same as # 2 (so I turned it back off). 
 
Any more help? 
 
Thanks again. 
 
Robert
 
[Back to original message] 
 |