lady_bug Posted March 4, 2006 Share Posted March 4, 2006 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! Quote Link to comment https://forums.phpfreaks.com/topic/4097-formmailer/ Share on other sites More sharing options...
Humpty Posted March 4, 2006 Share Posted March 4, 2006 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 clientsI 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. Quote Link to comment https://forums.phpfreaks.com/topic/4097-formmailer/#findComment-14253 Share on other sites More sharing options...
play_ Posted March 6, 2006 Share Posted March 6, 2006 Is there all that is to it?There should be more code, one that sets off the script when the "send" button is clicked... Quote Link to comment https://forums.phpfreaks.com/topic/4097-formmailer/#findComment-14516 Share on other sites More sharing options...
play_ Posted March 6, 2006 Share Posted March 6, 2006 ::edit:: Quote Link to comment https://forums.phpfreaks.com/topic/4097-formmailer/#findComment-14519 Share on other sites More sharing options...
Humpty Posted March 6, 2006 Share Posted March 6, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/4097-formmailer/#findComment-14520 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.