Posted by Csaba Gabor on 09/05/07 09:53
On Sep 4, 11:49 pm, JJM0926 <jjm0...@gmail.com> wrote:
> I've got a contact form with a submit button where users have to enter
> their support information. Some fields are required some are not.
> When I test out the form if I leave everything blank I get these two
> undefined index error :
>
> Notice: Undefined index: CurrentCustomer in E:\WebSites\mysite\www
> \contactus.php on line 9
>
> Notice: Undefined index: ContactMethod in E:\WebSites\mysite\www
> \contactus.php on line 19
>
> If I fill out at least the required fields everything is fine.
>
> Here's what the code looks like:
>
> <?php
> if (isset($_POST["Submit"])) // Trigger
> { ... }
> if isset($_POST['Name']) {
> $message = $message."Name: ".$_POST['Name']."\n";
> }
> ...
> ?>
In place of isset, sometimes it's useful to use:
http://php.net/array_key_exists
Csaba Gabor from Vienna
Navigation:
[Reply to this message]
|