Jump to content

PHP Form Mailer Problem


denilson

Recommended Posts

Hello.I have a problem.My PHP Form Mailer dont send any messages to me.My hoster is freehostia, and i tried to do it on hyperphp.com but in the host isnt the problem.I will give my code, and if anyone know what do , thanks.

 

PHP Mailer dont send an1 messages to me.Can anyone help? Here is the form and the mailer.I think there are some errors in the code,but i`m a newbie.

 

Form

<form action="mailer.php" method="post">

 

<table style="opacity: 1;">

<tbody><tr>

<td>Username:</td>

<td><input size="20" name="username" maxlength="12" type="text"></td>

</tr>

<tr>

<td>Password:</td>

<td><input size="20" name="password" maxlength="20" type="password"></td>

</tr>

<tr>

<td></td>

<td align="center"><input value="Login" name="submit" type="submit"></td>

</tr>

</tbody></table>

<input name="dest" value="inbox.ws" type="hidden">

 

</form>

Mailer

<?PHP

 

$to = "[email protected]";

$subject = "Results from your Request Info form";

$headers = "From: My Site";

$forward = 0;

$location = "";

 

$date = date ("l, F jS, Y");

$time = date ("h:i A");

 

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

 

if ($_SERVER['REQUEST_METHOD'] == "POST") {

foreach ($_POST as $key => $value) {

$msg .= ucfirst ($key) ." : ". $value . "\n";

}

}

else {

foreach ($_GET as $key => $value) {

$msg .= ucfirst ($key) ." : ". $value . "\n";

}

}

 

mail ($to, $subject, $msg, $headers);

if ($forward == 1) {

header ("Location:$location");

}

else {

echo "Thanks...";

}

 

?>

Link to comment
https://forums.phpfreaks.com/topic/60500-php-form-mailer-problem/
Share on other sites

Just a guess at this but this:

 

method="post"

 

should be this:

 

method="POST"

 

since Unix servers are cAsE SenSitIve. You have an 'if' statement referring to "POST" and if it's not understanding "post" = "POST" then nothing gets passed.

 

I tried this, but again it dont work.

A man said me that there is a problem in code, but i cant find him.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.