Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: PHp Email Forms

  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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 05:31 PM.

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Ohio
    Posts
    231
    Thanks
    3
    Thanked 21 Times in 21 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •