html form mailed by php

I finally got my html form to send an email by a php file, however, my data is not passing. The email only contains hard coded info, my variables re empty.

my html form method is “post”. I am using “$message = $_REQUEST[‘message’] ;” to pick up the message field data but nothing is passing between the two fies.

try using $_POST[‘message’];

otherwise.

can you post the code so we can look at it?

html form tag<FORM action="mailtest1.php" name="mailform" method="post" enctype="text/plain" onSubmit="return checkForm(this);"> <TEXTAREA name="message" cols="30" rows="6" class="field" wrap="VIRTUAL"></TEXTAREA>

This is calling php (no in testing format)[php]<?php

$to = "[email protected]";
$subject = “Test mail”;
$message = $_REQUEST[‘message’] ;

/* $message = “Hello! This is a simple email message from me.”;*/
$from = "[email protected]";
$headers = “From:” . $from;

/*
mail($to,$subject,$message,$headers);
echo “Mail Sent.”;
*/

$send = mail($to, $subject, $body, $headers) ;

if($send && $message != “”){

header( "Location: http://www.tristatecasinoparties.com/thankyou.htm" ) ; }

else

{ header( “Location: http://www.tristatecasinoparties.com/problem.htm” ) ; }

?> [/php]

Final file more extensive. This is cut down just to get things working

use $message here not $body…

you have this
[php] $send = mail($to, $subject, $body, $headers) ;
[/php]

should be this
[php] $send = mail($to, $subject, $message, $headers) ;
[/php]

INDEED its not working i don’t know if is known bug for POST but just use get on your form and it will work fine.

this is not the first time i have encountered that issue myself

data is not passing and I don’t know why. I made change to no avail. If you notice I’m testng for a $message value after the send.

yea i understand i tried to echo the $message too and it says variable not declared

did you try using GET on your html form?

yea, to no avail. I did application programming for 15 year and a little web work. Been off for 5 years for medical reasons. Now it’s like starting all over again. This should be a simple thing and its driving me nuts.

Works for me here is what I used…

mail_form.php
[php]

[/php]
mail_send.php

[php]<?php
$to = "[email protected]";
$subject = “Test mail”;
$message = $_REQUEST[‘message’];

/* $message = “Hello! This is a simple email message from me.”;*/
$from = "[email protected]";
$headers = “From:”.$from;

/*
mail($to,$subject,$message,$headers);
echo “Mail Sent.”;
*/

$send = mail($to, $subject, $message, $headers);

/* if($send && $message != “”){

header( "Location: http://www.tristatecasinoparties.com/thankyou.htm" ) ; }

else

{ header( “Location: http://www.tristatecasinoparties.com/problem.htm” ) ; }

*/

?> [/php]

I don’t see any real difference from what isn’t working for me. That’s why I’m thinking that my host hasn’t allowed POST on the server.

Helpdesk said I have to declare variables to use them. Are thses not declared properly?[php]<?php

$to = "[email protected]";
$subject = $_REQUEST[‘natureofinquiry’];
$message = $_POST[‘message’] ;
$from = "[email protected]";
$headers = “From:” . $from;
$body = $message + " " + $subject;

$send = mail($to, $subject, $body, $headers) ;

if($send && ($body != “”)){

header( "Location: http://www.tristatecasinoparties.com/thankyou.htm" ) ; }

else

{ header( “Location: http://www.tristatecasinoparties.com/problem.htm” ) ; }

?> [/php]

your variables are declared property maybe you should show them your code so they see for themselves

Sponsor our Newsletter | Privacy Policy | Terms of Service