Re: undefined index and php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux