E90Post
 


Extreme Powerhouse
 
BMW 3-Series (E90 E92) Forum > BMW E90/E92/E93 3-series General Forums > Regional Forums > UK > UK Off-Topic Discussions > Web help please PHP



Reply
 
Thread Tools Search this Thread
      01-12-2012, 08:22 AM   #1
Halpin13
Michael Halpin
Halpin13's Avatar
England
31
Rep
356
Posts

Drives: On the hunt
Join Date: Mar 2009
Location: North East

iTrader: (1)

Garage List
2005 E90 320i  [0.00]
Web help please PHP

hello all web guys, I'm needing a little help, I've searched the net and can't seem to find the information I'm after... at the moment i have set up a html contact from which has an action to go to a .php file, this then saves the data into csv file.

im also wanting to get a email notification every time someone fills the form in, i know i can't have two actions on the html form but surely there is some sort of php code i can use..

links below and thank you


http://www.rubb.co.uk/content/footer/contact_us2.htm

http://www.rubb.co.uk/content/footer/test.php
__________________
PSN - MHalpin13
Appreciate 0
      01-12-2012, 09:05 AM   #2
briers
Ben
briers's Avatar
United Kingdom
62
Rep
1,992
Posts

Drives: Tesla p85d
Join Date: May 2010
Location: Midlands,UK

iTrader: (0)

Yes in php, under the code for the csv just put in a simple mail function

Search for php mail function

It tells you the syntax, put your email in and a subject... Be sure to check your spam box. Send mail on Linux by default needs some tweakIng to avoid the spam boxes. In your case it doesn't matter because you aren't sending to users.
Appreciate 0
      01-12-2012, 09:13 AM   #3
Halpin13
Michael Halpin
Halpin13's Avatar
England
31
Rep
356
Posts

Drives: On the hunt
Join Date: Mar 2009
Location: North East

iTrader: (1)

Garage List
2005 E90 320i  [0.00]
would i use something like this.....


// Your email address
$email = "you@example.com";

// The subject
$subject = "Enter your subject here";

// The message
$message = "Enter your message here";

mail($email, $subject, $message, "From: $email");

echo "The email has been sent.";




i take it in the mail($.... i put the field ids of my form...

$name,$telephone,$email,$company,$requirements,$so urce


sorry I'm new to php and just self learning, thanks for the help
__________________
PSN - MHalpin13
Appreciate 0
      01-12-2012, 09:55 AM   #4
Halpin13
Michael Halpin
Halpin13's Avatar
England
31
Rep
356
Posts

Drives: On the hunt
Join Date: Mar 2009
Location: North East

iTrader: (1)

Garage List
2005 E90 320i  [0.00]
this has seemed to work


<?php

$name = $_POST['name'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$company = $_POST['company'];
$requirements = $_POST['requirements'];
$source = $_POST['source'];

//now we open the file using the a flag, this will create the file if
//it does not exist, and puts the pointer(where it starts writing) at the
//end of the file
$filename = "formresults2.csv";
$handle = fopen($filename, 'a');


//now we prepare our string to be added:
$string_to_add = "$name,$telephone,$email,$company,$requirements,$s ource\n";
fwrite($handle, $string_to_add);

//now close the file
fclose($handle);



$name = $_REQUEST['name'];
$telephone = $_REQUEST['telephone'];
$email = $_REQUEST['email'];
$company = $_REQUEST['company'];
$requirements = $_REQUEST['requirements'];
$source = $_REQUEST['source'];

// message
$message = "
Rubb Buildings Contact us Form

Name - $name
Telephone - $telephone
Company - $company
Requirements - $requirements
Source - $source

";

// Mail it
mail("mjhalpin13@gmail.com", "rubbcontactus: $subj", $message, "From: $email");


?>
__________________
PSN - MHalpin13
Appreciate 0
Reply

Bookmarks


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



All times are GMT -5. The time now is 04:23 AM.




e90post
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
1Addicts.com, BIMMERPOST.com, E90Post.com, F30Post.com, M3Post.com, ZPost.com, 5Post.com, 6Post.com, 7Post.com, XBimmers.com logo and trademark are properties of BIMMERPOST