Jump to content


Photo

formmailer


  • Please log in to reply
4 replies to this topic

#1 lady_bug

lady_bug
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 04 March 2006 - 06:28 PM

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:


(...)

$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;  
 

?>


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

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

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!


#2 Humpty

Humpty
  • Members
  • PipPipPip
  • Advanced Member
  • 132 posts

Posted 04 March 2006 - 09:13 PM

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.
- Humpty
  #> Where does the light go when it goes out?

#3 play_

play_
  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 06 March 2006 - 01:39 AM

Is there all that is to it?
There should be more code, one that sets off the script when the "send" button is clicked...
regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin

#4 play_

play_
  • Staff Alumni
  • Advanced Member
  • 717 posts

Posted 06 March 2006 - 02:01 AM

::edit::
regex.kat.sh --- regex library
u.kat.sh ---- url shortener
tabbit.org ---- tabbed pastebin

#5 Humpty

Humpty
  • Members
  • PipPipPip
  • Advanced Member
  • 132 posts

Posted 06 March 2006 - 02:02 AM

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.
- Humpty
  #> Where does the light go when it goes out?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users