|
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]
|