Jump to content

Recommended Posts

I'm glad there's a newbie corner cause I don't have a clue how to solve this:

I have a php-mailer script (pre-installed by brinkster.com) and want to use this in my contact file. My php header looks like this:

[code]

(...)

$mail->From = "feedback@mydomain.com";

$mail->FromName = "My Name";

$mail->AddAddress("another@adress.com");

$mail->IsHTML(true);

$mail->Subject = "Feedback";

$mail->Body = $_POST['message'];  
  
if(!$mail->Send())  
{  
echo "Message was not sent <p>";  
echo "Mailer Error: " . $mail->ErrorInfo;  
}  
return TRUE;  


?>

[/code]

and in my html part I have a form that looks like this:

[code]
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="post">
(...)
<textarea class="input1" name="message" type="text" cols="30" rows="12" tabindex="9"></textarea>
[/code]

So how do I tell my php part which part of the form has to be sent as message body? I guess this $mail->Body = $_POST['message']; is wrong.

thanks for your help!
Link to comment
https://forums.phpfreaks.com/topic/4097-formmailer/
Share on other sites

I too wanted to do this but found it didn't work.

MailTo I could get to work. I had for form send the data to the same file as the form, Reload the data into the fields after checking that all the data was correct and then also provide a href mailto link. This works just fine.

I am going to convert that though into the mail() PHP function because supposedly using the many variables of the mailto HTML can cause probs with differenct email clients

I like the way that it gives the user the option to change so when I'm done my form will do the following:

FORM
> Submit to same page.
Reload data into FORM again for checking by user, (this also allows me to check that fields are correctly entered with some PHP if - thens.

Once page reloads the user will have the option of clicking a mailto link or clicking another button in the form that reloads the page again and this time uses the mail() PHP function.
Link to comment
https://forums.phpfreaks.com/topic/4097-formmailer/#findComment-14253
Share on other sites

I use a the switch statement / function to differentiate between 2 different buttons from one form.

Use "apply" to send the data through the first run and then "send" or "apply to send it on the second run or change the details.


alternativley you can set a hidden text field with nothing and then on the first run change it to something.

There could be better ways but this way works and I understand it.
Link to comment
https://forums.phpfreaks.com/topic/4097-formmailer/#findComment-14520
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.