Jump to content

PHP to send form details to email account, print to .CSV file


ginga

Recommended Posts

Hi

 

Im new to the forum, new to PHP and have a problem with this form im using.

I need to get this form to send its details that a person inputs to a .csv file.

 

At present I know nothing about .csv files apart from that they hold all the information sent from the form.

 

Im using PHP to send the details but am also having trouble with this. At present I will settle having the form details sent to an email address but ideally I would like to be able to send all details to a .csv file.

 

Any advice or help will be greatly appreciated.

 

here is the code im using:

 

<?php

$title = $_REQUEST['title'];

$firstname = $_REQUEST['firstname'];

$surname = $_REQUEST['surname'];

$address1 = $_REQUEST['address1'];

$address2 = $_REQUEST['address2'];

$city = $_REQUEST['city'];

$postcode = $_REQUEST['postcode'];

$email = $_REQUEST['email'];

$telephone = $_REQUEST['telephone'];

$message = $_REQUEST['comments'];

$twobed = $_REQUEST['2bed'];

$threebed = $_REQUEST['3bed'];

$fourbed = $_REQUEST['4bed'];

$penthouse = $_REQUEST['pent'];

?>

<h2>Title: <?php echo $title ?></h2>

<h2>Name: <?php echo $firstname ?> <?php echo $surname ?></h2>

<h2>Email: <?php echo $email ?></h2>

<h2>Telephone: <?php echo $telephone ?></h2>

<p>Your message: <?php echo $message ?></p>

<h3><img src="images/location/location.jpg" width="1024" height="404">Thanks for the message!</h3>

<?php

$message = "Email from Ogilvie Homes contact form \n

From:$title $firstname $surname \n

Interested in: $twobed / $threebed / $fourbed / $penthouse \n

Address: $address1 \n

$address2 \n

$city \n

$postcode \n

Email: $email \n

Tel: $telephone \n

Message: \n".$message;

//

mail("emailaddress@.com", "Email from from me", $message, "From:$email");

?>

 

Thank you very much

 

Ginga

Link to comment
Share on other sites

First thanks for getting in touch so fast

 

The problem at the moment is that the check boxes I have within my form, once checked, are not showing up in my email after being sent.

 

This is the same problem I'm having with the comments parts of the form.

 

Ginga

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.