Re: Re: php form action breaks script

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

 



On Wed, Jun 27, 2012 at 7:17 PM, Tim Dunphy <bluethundr@xxxxxxxxx> wrote:


One more little thing:

These notices:

> Notice: Undefined index: subject in
> /Library/WebServer/Documents/examples/ch03/final/makemeelvis/sendemail.php
> on line 23 Notice: Undefined index: elvismail in
> /Library/WebServer/Documents/examples/ch03/final/makemeelvis/sendemail.php

show up because you are processing form fields in $_POST when there
might not be any yet.

These lines:

>  $from = 'bluethundr@xxxxxxxxxxxx';
>  $subject = $_POST['subject'];
>  $text = $_POST['elvismail'];
>  $output_form = "false";


Should appear *after* this line:

>  if (isset($_POST['Submit'])) {


You should also check the $_POST entries for 'subject' and 'elvismail'
to make sure they are set to avoid the notices, even if you do move
them after the submit check. You never know!

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