Forums

Include form fields in subject line

MistaT2000 29 Jul, 2008
Hi Folks,

I have searched the forum and cant find what i'm looking for. I basically need to list the form fields in the subject line.

I have the form fields Agent, Postcode, field, txname and contactid. I want them to appear in the subject line like this:

Subject: Agent Name: $Agent Postcode: $Postcode Description: field TXName: $txname Contact ID: $contactid

I found the following script:

<?php
$rows[0]->emailsubject = "Contact ID:".$_POST['contactid']."".$_POST['Postcode']." how are you?";?>


but am having trouble modifying it for my requirements 😟

Can anyone help? 🙂
GreyHead 29 Jul, 2008
Hi MistaT2000,

What problem are you having??
<?php
$rows[0]->emailsubject = "Agent Name: ".$_POST['Agent']." Postcode: ".$_POST['Postcode']." Description: ".$_POST['field']." TXName: ".$_POST['txname']." Contact ID: ".$_POST['contactid'];
?>

should do it if the field names are correct - but it could be a ridiculously long subject and may cause unexpected errors or be truncated.

Bob
MistaT2000 29 Jul, 2008
Thankyou Bob your a star!!!!

It worked fine!! The client wants 'more or less' all the form data in the subject line so when the email hits their inbox they dont bother opening it but read the subject line instead.. 🙄

Thanks again for the solution :wink:
This topic is locked and no more replies can be posted.