|
|
|
|
|
|
BMW Garage | BMW Meets | Register | Today's Posts | Search |
|
BMW 3-Series (E90 E92) Forum
>
Web help please PHP
|
|
01-12-2012, 08:22 AM | #1 |
Michael Halpin
31
Rep 356
Posts
Drives: On the hunt
Join Date: Mar 2009
Location: North East
|
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
|
01-12-2012, 09:05 AM | #2 |
Ben
62
Rep 1,992
Posts |
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 |
Michael Halpin
31
Rep 356
Posts
Drives: On the hunt
Join Date: Mar 2009
Location: North East
|
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 |
Michael Halpin
31
Rep 356
Posts
Drives: On the hunt
Join Date: Mar 2009
Location: North East
|
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
|
Bookmarks |
|
|