You are here: Re: variable problem in address book script « All PHP « IT news, forums, messages
Re: variable problem in address book script

Posted by J.O. Aho on 01/01/07 12:12

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация