Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-06-2008, 04:11 PM   PM User | #1
james_rm
New to the CF scene

 
Join Date: Aug 2008
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
james_rm is an unknown quantity at this point
PHp Email Forms

Hi Guys,
Just a quick question I have to create multiple forms for different car inquires I was just wondering if I am able to include a Title tag from the page into the email that is sent with the customers details on it?

PHP Code:
<?php
                            
                            $to 
'jca@*****.co.uk'
                            
$from 'Contact Form';
                            
$name $_REQUEST['Name']; 
                            
$headers "From: $from"
                            
$subject "Contact Form | $name"
                                                        
                            
$fields = array(); 
                            
$fields{"Name"} = "Name"
                            
$fields{"Number"} = "Number"
                            
$fields{"Email"} = "Email"
                            
$fields{"Message"} = "Message"
                                                        
                            
$body "We have received the following information:\n\n";
                            
                            foreach(
$fields as $a => $b){ $body .= sprintf("%50s: %s\n",$b,$_REQUEST[$a]); } 
                    
                            
$send mail($to$subject$body$headers);
                             
                            
?>
This is the form code I am using I am wanting to display the Title of the page that has the submit button on.

Last edited by james_rm; 08-06-2008 at 04:31 PM..
james_rm is offline   Reply With Quote
Old 08-06-2008, 04:22 PM   PM User | #2
derzok
Regular Coder

 
Join Date: May 2008
Location: Ohio
Posts: 231
Thanks: 3
Thanked 21 Times in 21 Posts
derzok is an unknown quantity at this point
Depends - is the title hardcoded into the page or can it change depending on what the page is displaying (the form page, that is)? If it's static, just set a variable $title = 'the title of this page'; If the title is dynamically created it might already be stored in a variable like that. In either case, once the variable is set, you can use it freely inside of your php code that composes the email. Post the code and we can show you how.
__________________
zok@zoklet:~$ whereis zok
zok: http://zoklet.net | http://zoklet.net/otg | /derzok/at/gmail/dot/com
derzok is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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


All times are GMT +1. The time now is 10:04 PM.


Advertisement
Log in to turn off these ads.