Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8378983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:03:29+00:00 2026-06-09T16:03:29+00:00

I am making a coming soon page for my website and it including text-box

  • 0

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;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:03:30+00:00Added an answer on June 9, 2026 at 4:03 pm

    There are two issues in your current code

    1. Email to specific entry.

      You can use Direct Mail function of php. Or you can use PHP Mailer (for localhost testing its best)

    2. 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.

      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'];
      
          function array_insert($array, $pos, $val)
          {
              $array2 = array_splice($array, $pos);
              $array[] = $val;
              $array = array_merge($array, $array2);
              return $array;
          } 
      
          if(empty($errorMessage)) 
          {
      
              $DataToInsert = $name.','.$email;
              $PositionToInsert = 1;
      
              //Full path & Name of the CSV File
              $FileName = 'mydata.csv';
      
              //Read the file and get is as a array of lines.
              $arrLines = file($FileName);
      
              //Insert data into this array.
              $Result = array_insert($arrLines, $PositionToInsert, $DataToInsert);
      
              //Convert result array to string.
              $ResultStr = implode("\n", $Result);
      
              //Write to the file.
              file_put_contents($FileName, $ResultStr);
      
              $to      = $email;
              $subject = 'Thank You';
              $message = 'We will soon contact you';
              $headers = 'From: youremail@gmail.com' . "\r\n" .
                         'Reply-To: youremail@gmail.com' . "\r\n" .
                         'X-Mailer: PHP/' . phpversion();
      
              mail($to, $subject, $message, $headers);
      
      
              header("Location: werememberyou.html");
              exit;
          }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Coming from a Web Development background I am now into QT Applications development. Working
Hihi, I'm making a coming soon site for my upcoming game and I have
I have a project due soon and everything is coming together really nicely, but
Making a new site but something is happening to it in IE8. The social
Making a new site but something is happening to it in IE. I've purchased
I'm making a request via urllib2 that is coming back with the following headers:
I'm making a simple compiler for a simple pet language I'm creating and coming
I'm making a particle system for my game, which basically is smoke coming out
I'm making a newsfeed type of thing and I want to select from multiple
I'm coming from a Rails background, and am having a bit of trouble making

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.