> I tried this to set the value...
>
> if (!isset($_POST['heading'])) {
> $_POST ['heading'] = "";
> }
>
> because the following line give the notice 'undefined index'  BEFORE  the
> submit button has been pressed..
>
> <? $heading_insert= stripslashes($_POST['heading']);?>


What everyone else said, but also:

It's not good practice (in fact I don't even know if it's possible) to
modify the contents $_POST programmatically. It contains, as you no doubt
know, all of the variables POSTed to the script, generally by the submission
of a form with method="POST".

It would be better for you to assign the contents of $_POST to local
variables.  Firstly, you will be able to do any necessary checks and
modifications (length, variable type, presence of illegal characters and so
on) at the point when you create the variable. This will save you time if
you need to use the value multiple times on the same page.

example:

 $heading='';
 if (isset($_POST['heading'])) {
     $heading=$_POST ['heading'];
 }

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

Reply via email to