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 8805861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:58:23+00:00 2026-06-14T01:58:23+00:00

I am working to make a form where I can collect names and email

  • 0

I am working to make a form where I can collect names and email addresses and send them to a MySQL database for storage. I wrote the HTML and PHP file and it seems to be working. It echoes “Thank you for entering an email!”. When I look at the database it creates a line for the data but all the fields are blank. I am not sure what’s going on, and this is the first time I have worked with a database. Thanks for all your help!

HTML

<form action='/submitEmail.php' action='POST'>
  <p>First name: <input type='text' id="firstname" name='firstname' /></p>
  <p>Last name: <input type='text' id="lastname" name='lastname' /></p>
  <p>Email: <input type='text' name='email' /></p>
  <input type='submit' value='Submit Email' />
</form>

PHP

<?php
  // Connecting to the MySQL server
  $host="myHost";
  $user_name="myUsername";
  $pwd="myPassword";
  $database_name="myDatabase"; //assuming you created this
  $db=mysql_connect($host, $user_name, $pwd);
  if (mysql_error() > "") print mysql_error() . "<br>";
  mysql_select_db($database_name, $db);
  if (mysql_error() > "") print mysql_error() . "<br>";
  // Storing form values into PHP variables
  $firstname = $_POST["firstname"]; // Since method="post" in the form
  $lastname = $_POST["lastname"];
  $email = $_POST["email"];
  // Inserting these values into the MySQL table
  // we created above
  $query = "insert into email_list (firstname, lastname, email) values ('" . $firstname . "', '" . $lastname . "', '" . $email . "')";
  $result = mysql_query($query);
  // mysql_query() is a PHP function for executing
  // MySQL queries
  echo "<p>Thank you for entering an email!</p>";
?>
  • 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-14T01:58:25+00:00Added an answer on June 14, 2026 at 1:58 am

    Attribute method should be post.

    <form action='/submitEmail.php' method='POST'>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a CSS/HTML submit form that I am going to make
I'm trying to make a simple form, but it's working not so fine. This
i am working to make a Android application that can upload and download data
I'm trying to make it working for quite some time,but just can't seem to
I'm trying and trying and can't make it working. I have a ul class=first
how can i make java program working with multiple languages (frensh, english , arabic
I'm working with a GUI in PowerShell and trying to make the form such
Can the form-login tag make use of URLs to external resources? I have two
I'm working on a form where I have 2 fields which can be added
I have a problem with a form, I can't send it. If I put

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.