I am making a coming soon page for my website and it including text-box for name and email I am working on asp but now I want php or html5 coding since I complete my project.
I want to insert the data in a csv file and also send a auto generated mail on the user email address with php is it possible and how can anyone help me out of this.
Have two textbox name and email.
Can you give me the code as I am new in php?
The code I found on google:
if($_POST['formSubmit'] == "Submit")
{
$errorMessage = "";
if(empty($_POST['name']))
{
$errorMessage .= "<li>without name how can we send you invitation</li>";
}
if(empty($_POST['email']))
{
$errorMessage .= "<li>i think email id is required</li>";
}
$name = $_POST['name'];
$email = $_POST['email'];
if(empty($errorMessage))
{
$fs = fopen("mydata.csv","a");
fwrite($fs,$name . ", " . $email . "\n");
fclose($fs);
header("Location: werememberyou.html");
exit;
There are two issues in your current code
Email to specific entry.
You can use Direct Mail function of php. Or you can use PHP Mailer (for localhost testing its best)
Adding Entry to CSV file.
Here you can have a problem in future to add new entry to your current file. so i have added some code which you can use.