Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Undefined index error

Status
Not open for further replies.

gregmosu

Programmer
Jul 8, 2002
117
US
Here is the error that I'm getting in my error.log

>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: poster in
>c:\program files\apache group\apache\htdocs\contact.php on line 29
>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: name in
>c:\program files\apache group\apache\htdocs\contact.php on line 63
>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: company
>in c:\program files\apache group\apache\htdocs\contact.php on line 64
>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: street in
>c:\program files\apache group\apache\htdocs\contact.php on line 65
>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: city in
>c:\program files\apache group\apache\htdocs\contact.php on line 66
>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: state in
>c:\program files\apache group\apache\htdocs\contact.php on line 67
>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: zip in c:
>\program files\apache group\apache\htdocs\contact.php on line 68
>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: email in
>c:\program files\apache group\apache\htdocs\contact.php on line 69
>[Mon Oct 28 08:59:29 2002] [error] PHP Notice: Undefined index: comments
>in c:\program files\apache group\apache\htdocs\contact.php on line 70


This script works fine locally, but when I upload it to the server, I get theses error. All I can think of is that the php.ini file is incorrectly configured, but I'm very new to php and it might be something in my code.

I have a form that submits to this code...

<?
$mailSent = &quot;false&quot;;

///////////////////////////////
//POSTER is one of the errors//
///////////////////////////////

if($HTTP_POST_VARS[&quot;poster&quot;] != &quot;&quot; && $HTTP_POST_VARS[&quot;name&quot;] != &quot;&quot;){
$ToEmail = &quot;MyName@aol.com&quot;;
$ToSubject = &quot;Contact Form&quot;;

$eName=$HTTP_POST_VARS[&quot;name&quot;];
$eCompany=$HTTP_POST_VARS[&quot;company&quot;];
$eStreet=$HTTP_POST_VARS[&quot;street&quot;];
$eCity=$HTTP_POST_VARS[&quot;city&quot;];
$eState=$HTTP_POST_VARS[&quot;state&quot;];
$eZip=$HTTP_POST_VARS[&quot;zip&quot;];
$eEmail=$HTTP_POST_VARS[&quot;email&quot;];
$eComments=$HTTP_POST_VARS[&quot;comments&quot;];

$EmailBody = &quot;Name: $eName\nCompany: $eCompany\nStreet: $eStreet\nCity: $eCity\nState: $eState\nZip: $eZip\nEmail: $eEmail\nComments: $eComments&quot;;

$Message = $EmailBody;
if(mail(&quot;Tech <&quot;.$ToEmail.&quot;>&quot;,$ToSubject, $Message, &quot;From: &quot;.$eName.&quot; <&quot;.$eEmail.&quot;>&quot;)){
echo &quot;<font face=Arial,Helvetica,Geneva,Swiss,SunSans-Regular color=#003399>Thank You!</font><br>&quot;;
echo &quot;<font face=Arial,Helvetica,Geneva,Swiss,SunSans-Regular color=#003399>Your message has been sent...</font>&quot;;
$eName=&quot;&quot;;
$eCompany=&quot;&quot;;
$eStreet=&quot;&quot;;
$eCity=&quot;&quot;;
$eState=&quot;&quot;;
$eZip=&quot;&quot;;
$eEmail=&quot;&quot;;
$eComments=&quot;&quot;;
$mailSent=&quot;true&quot;;
$HTTP_POST_VARS[&quot;poster&quot;]=&quot;&quot;;
$HTTP_POST_VARS[&quot;name&quot;]=&quot;&quot;;
} else {
echo &quot;<font face=Arial,Helvetica,Geneva,Swiss,SunSans-Regular color=#003399>An error has occured, please reload page and try again.</font><br><br>&quot;;
}
} else {

///////////////////////////////////////////
//Section below produces the other errors//
///////////////////////////////////////////

$eName=$HTTP_POST_VARS[&quot;name&quot;];
$eCompany=$HTTP_POST_VARS[&quot;company&quot;];
$eStreet=$HTTP_POST_VARS[&quot;street&quot;];
$eCity=$HTTP_POST_VARS[&quot;city&quot;];
$eState=$HTTP_POST_VARS[&quot;state&quot;];
$eZip=$HTTP_POST_VARS[&quot;zip&quot;];
$eEmail=$HTTP_POST_VARS[&quot;email&quot;];
$eComments=$HTTP_POST_VARS[&quot;comments&quot;];
}

Thanks,
Greg
 
Do a print_r() on $HTTP_POST_VARS.

Do the keys in question exist?
______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top