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 Mr. Newt on 01/01/07 17:32

"J.O. Aho" <user@example.net> wrote in message
news:4vsu6eF1d5gomU1@mid.individual.net...
> Geoff Berrow wrote:
>> Message-ID: <r9OdnVl04t_fqwTYnZ2dnUVZ_sudnZ2d@adelphia.com> from Mr.
>> Newt contained the following:
>
> Please fix news client to remove everything including and after '-- '
> thats first and only on a line, or manually remove the text.
>
>
>>>> $mode=$_POST['mode'];
>>>> $name=$_POST['name'];
>>>> $phone=$_POST['phone'];
>>>> $email=$_POST['email'];
>>>> $id=$_POST['id'];
>
>>> 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).
>
> With a too high error logging you can get such when you load the page the
> first time, as then $_POST['mode'] won't have been sent to the script
> (same applies the other values too).
>
>
>> They should be $_GET not $_POST
>
> from the code:
> --- script ---
> <form action=';
> echo 'PHP_SELF';
> Print '
> method=post>
> --- eof ---
>
> The method that the data is sent, should be post, of course the action and
> method values should be double quoted, to get things work better in most
> browsers, including the broken one that most people seems to use.
>
>> try this:
>> $mode=(isset($_GET['mode']))? $_GET['mode']) : "" ;
>>
>> (and similar for all the other variables)
>>
>> I suspect the error "Undefined variable: mode." is more to do with
>> faults in the original script and error reporting set to E_ALL than your
>> setup.
>
> This code will retrieve the variables, and will check for php.ini settings
> and consider if the php is an outdated version or those of the newer line.
>
>
> if(!get_cfg_var("register_globals")) {
>
> if (!empty($_GET)) {
> extract($_GET);
> } else if (!empty($HTTP_GET_VARS)) {
> extract($HTTP_GET_VARS);
> }
>
> if (!empty($_POST)) {
> extract($_POST);
> } else if (!empty($HTTP_POST_VARS)) {
> extract($HTTP_POST_VARS);
> }
>
> if (!empty($_COOKIE)) {
> extract($_COOKIE);
> } else if (!empty($HTTP_COOKIE_VARS)) {
> extract($HTTP_COOKIE_VARS);
> }
> }
>
> Good thing would be if OP would tell us which version of PHP he is using.
>
> --
>
> //Aho
I'm using PHP 5.2 on WinXP. I also have it (most recent version) running on
Ubuntu 6.10 (I try to get things working on Windows first because it's
usually less problematic).

 

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

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