Reply to Re: [PHP] undefined index and php

Your name:

Reply:


Posted by Jasper Bryant-Greene on 11/10/05 14:19

Ross wrote:
> because the following line give the notice 'undefined index' BEFORE the
> submit button has been pressed..
>
> <? $heading_insert= stripslashes($_POST['heading']);?>

That's because before the submit button has been pressed, $_POST is
empty and so 'heading' is indeed an undefined index. Try:

$heading_insert = isset( $_POST['heading'] ) ? stripslashes(
$_POST['heading'] ) : '';

By the way, while you're switching register_globals off, it might be a
good idea to also switch off magic_quotes_gpc (the reason you need
stripslashes() above) and short_open_tag (judging by your use of the
non-portable <? open tag rather than <?php).

Jasper

[Back to original 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

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