5 Replies - 1208 Views - Last Post: 29 May 2009 - 02:42 PM Rate Topic: -----

#1 lender  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-May 09

Php Contact form

Post icon  Posted 29 May 2009 - 01:50 PM

My php processing form do not work. I want to know the reason. I upload all my files in www of the folder in the hosting I bought.
$to = "pastor@holyghostfellowship.org
$from = $_REQUEST["email"];
$headers ="From: $from";
$subject "Registration";
$fields{"Firstname"} ="Firstname";
$fields{"Lastname"} ="Lastname";
$Fields{"Sex"} ="sex";
$fields{"contact address"} ="contact address";
$fields{"country"} ="country";
$fields{"zipcode"} ="zipcode';
$fields{"mobile telephone"} ="mobile telephone";
$fields{'email"} ="email";
$body = "We have received the following information:\n\n";
foreach ($fields as $a=>$b) {"%20s:%s\n", $b, $_REQUEST[$a});
}
$headers2 ='from:noreply@mydomain.org"; 
$subject2 ="Thank you for joining our membership";
if ($from==''){
print"You have not entered an email, please go back and try aain";
}
else {
if ($Firstname==''){
print"You have not entered a name please go back and try again";
}
else {
$send = mail($to, $subject, $body, $headers);
$send2 =mail($from, $subject2, $headers2)
if ($send){
header ("Location:http://www.mydomain.org/thankyou.html");
}
else {
print"We encountered an error sending your mail, please notify 
me@mydomain.org;
}
}
}
?> 


Is This A Good Question/Topic? 0
  • +

Replies To: Php Contact form

#2 AlienWebguy  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 84
  • Joined: 04-March 09

Re: Php Contact form

Posted 29 May 2009 - 01:53 PM

First change

$headers2 ='from:noreply@mydomain.org";

to

$headers2 ="from:noreply@mydomain.org";
Was This Post Helpful? 0
  • +
  • -

#3 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 3034
  • Posts: 10,589
  • Joined: 08-August 08

Re: Php Contact form

Posted 29 May 2009 - 01:58 PM

What's going on here?

foreach ($fields as $a=>$b) {"%20s:%s\n", $b, $_REQUEST[$a});
}



Also, $fields != $Fields. PHP is case sensitive.
Was This Post Helpful? 0
  • +
  • -

#4 ShaneK  Icon User is offline

  • require_once("brain.php"); //Fatal error :/
  • member icon

Reputation: 240
  • View blog
  • Posts: 1,224
  • Joined: 10-May 09

Re: Php Contact form

Posted 29 May 2009 - 02:10 PM

Also change
$fields{"zipcode"} ="zipcode';
to
$fields{"zipcode"} ="zipcode";


And also
$fields{'email"} ="email";
should be
$fields{"email"} ="email";


Also
print"We encountered an error sending your mail, please notify 
me@mydomain.org;
should be
print "We encountered an error sending your mail, please notify 
me@mydomain.org";


Interesting code here, but I really feel that you could figure out 99% of these errors by manually debugging it......

Yours,
Shane~

This post has been edited by ShaneK: 29 May 2009 - 02:13 PM

Was This Post Helpful? 0
  • +
  • -

#5 mephtu  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 28-December 08

Re: Php Contact form

Posted 29 May 2009 - 02:41 PM

Change:
foreach ($fields as $a=>$b) {"%20s:%s\n", $b, $_REQUEST[$a});
}

to:
foreach ($fields as $a=>$b) {
  $body .= sprintf("%20s:%s\n", $b, $_REQUEST[$a]);
}

Was This Post Helpful? 0
  • +
  • -

#6 RPGonzo  Icon User is offline

  • // Note to self: hmphh .... I forgot
  • member icon

Reputation: 151
  • View blog
  • Posts: 954
  • Joined: 16-March 09

Re: Php Contact form

Posted 29 May 2009 - 02:42 PM

LOL this is one big debug session :P :D hope the OP is taking notes .....
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1