help with email form

This is a discussion on help with email form within the PHP Language forums, part of the PHP Programming Forums category; On Aug 14, 2:13 pm, Tim Ferguson <Ferguso...@softhome.net> wrote: > Loki25 <kgarnet...@gmail.com&...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #21 (permalink)  
Old 08-16-2007
Loki25
 
Posts: n/a
Default Re: help with email form

On Aug 14, 2:13 pm, Tim Ferguson <Ferguso...@softhome.net> wrote:
> Loki25 <kgarnet...@gmail.com> wrote in news:1186991766.268471.180630
> @o61g2000hsh.googlegroups.com:
>
> >> $message="web email\n";
> >> $message=.$_POST['message']."\n";

>
> I think this should be
>
> $message .= $_POST['message']."\n";
>
> since the operator is .= not =.
>
> Tim F


good catch

Reply With Quote
  #22 (permalink)  
Old 08-16-2007
Tyno Gendo
 
Posts: n/a
Default Re: help with email form

alice wrote:
> On Aug 6, 7:15 pm, Loki25 <kgarnet...@gmail.com> wrote:
>> On Aug 6, 10:13 pm, alice <al...@fearofdolls.com> wrote:
>>
>>
>>
>>
>>
>>> Can anyone tell me why this code won't work?
>>> I've saved it as mail.php, and have a form on a web page with
>>> action="mail.php" in the html. I've gotten this to work before on
>>> other pages I've worked on, I can't figure out why it's not working
>>> today, I must have forgotten something. The thank you page comes up,
>>> but the mail is not actually delivered.
>>> <?php
>>> $to="g...@fearofdolls.com";
>>> $subject="Fear of Dolls web email";
>>> $email=$_POST["email"];
>>> $message="From Fear of Dolls web email\n";
>>> $message.="message: ".$message."\n";
>>> $head="From: f...@fearofdolls.com";
>>> mail($to,$subject,"".$message,$head);
>>> header("Location:thankyou.html");
>>> ?>

>> I can't see any reason why it wouldn't work, are you getting an error
>> message? if not, then the code is probably working and your problem is
>> that the SMTP server isn't properly set in your configurations.- Hide quoted text -
>>
>> - Show quoted text -

>
> Not getting any error messages. Where are the configurations that you
> speak of?
>


Just a note, but you should get a return value from mail() to say
whether it worked or not.

eg:
if ( !mail($to, $subject, $message, $head) ) {
exit("Achk... something not right.");
}

and also something to note, when I write out a header for a redirect
I always encapsulate it in an exit, i've used ti before in code and
found that header() doesn't actually quite your code, so you have
danger of some code after the header being executed... eg.

header( 'Location: offwego.php' );
// next line would execute even though the header redirects
mysql_query("DELETE FROM users WHERE user_id={$user_id}");

PS. Did you get this working? be careful from with From: field, some
server drop mail if the From is invalid.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:25 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0