Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-17-2008, 05:37 AM
spawny is offline spawny
Registered User

Join Date: Sep 2008
Posts: 1

Add text to body in phMailer

HI Guys,

i´m new to PHP but i love this phMailer script. My one question after hours of searching the web is how do i add variable outpts to the body of the mail. For example, if i add a new field called $companyname, and i want the message body to start with:

From $companyname

how do i do this?
Reply With Quote
  #2  
Old 09-17-2008, 06:26 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

Here is a good tutorial on php and web forms:
http://www.w3schools.com/php/php_forms.asp

Read the above brief tutorial and then follow below...

As for adding them into the body of the email phMailer sends,
you will want to find the line:
$message.="$yourmessage";

Basically, create a new line two lines above it and replace $yourmessage with your $_POST information.

An example would look like:

$message.="Company Name: $_POST['company_name']";
$message.="\n";
$message.="Another field: $_POST['field_name']";
$message.="\n";
$message.="$yourmessage";

Sorry if this is a bad explanation, im not to good at explaining things.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #3  
Old 09-17-2008, 08:32 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
It can be done other ways but that way is the easiest I know of.

$_POST['company_name']; assumes that you have named the html element company_name.

Make sure you only name the element, don`t put ID's on them...that's an error in XHTML.

$message.="Company Name: ".$_POST['company_name'];
$message.="\n";
$message.="Another field:".$_POST['field_name'];
$message.="\n";
$message.="$yourmessage";
__________________
Reply With Quote
  #4  
Old 09-18-2008, 09:47 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

Quote:
Originally posted by atholon
Make sure you only name the element, don`t put ID's on them...that's an error in XHTML.
Where did you hear that?

http://www.w3.org/TR/xhtml1/
Read sec 4.10

Quote:
Note that in XHTML 1.0, the name attribute of these elements is formally deprecated, and will be removed in a subsequent version of XHTML.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #5  
Old 09-18-2008, 01:17 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
XHTML 1.4 does not allow that.

I tried it and it freaked out.

It's lameness does not allow iFrames either which is stupid.
__________________
Reply With Quote
  #6  
Old 09-18-2008, 06:32 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

That's extremely odd how they would deprecate the name element for xhtml 1.0 and then deprecate id for 1.4 and bring back name.

I can't comment on the iframe but if ID is going to be taken out i'd like to see some document that states it on w3's website.

Not trying to call you out or anything but I can't find anything and i'd like to know where you heard that from.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #7  
Old 09-18-2008, 06:55 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
I'll find it, I can`t remember what DTD we were using. Let me look into it. I was pretty shocked when I saw it.
__________________
Reply With Quote
  #8  
Old 09-18-2008, 07:09 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
Quote:
Line 14, Column 56: element "iframe" undefined.
<iframe src="src" id="fileframe" name="fileframe"></iframe>
I still am not sure if I was using XHTML 1.1. You may be right Scott but I had a heck of a time trying to get it to work with ID's on form elements.
__________________
Reply With Quote
  #9  
Old 09-19-2008, 12:07 AM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
I must be halucinating Scott. I swear I was getting "invalid property" when I assigned an ID to an input field. O-well looks like XHTML 1.1 accepts it.

Sorry to mislead. It still doesn`t support iframes though.
I think it was because I had the ID in caps.
Quote:
Line 9, Column 35: there is no attribute "ID".
<input type="text" name="title" ID="myid"/>
__________________

Last edited by atholon; 09-19-2008 at 11:16 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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 On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHmailer with 7 attachments getts error message and text but not attachments in email sent Idiotsavant phphq.Net Forums 4 09-08-2010 06:02 PM
phMailer - add Subject EntryField rosdi phphq.Net Forums 0 04-30-2009 11:08 AM
does any body have a clue??? bigsmellyfart Humor & Jokes 0 06-17-2006 01:34 AM
Body Piercing!! Scorpion101 Humor & Jokes 4 07-31-2005 01:56 PM
add text fields? planetfall phphq.Net Forums 1 06-09-2005 06:29 PM


All times are GMT -5. The time now is 04:55 PM.




Powered by vBulletin®