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("[email protected]", "Email from from me", $message, "From:$email");

?>

 

Thank you very much

 

Ginga

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.