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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:57:39+00:00 2026-05-27T03:57:39+00:00

I have a form in a HTML file that will post values from the

  • 0

I have a form in a HTML file that will post values from the form into a database, via a PHP script.

Unfortunately, when I click the submit button, my form will not call the PHP script. However, if I type in the URL of the PHP file, the PHP file will run and insert a blank row in the database. Therefore, my guess is that my HTML file never calls the PHP script.

Since I am new to PHP and HTML forms, is there any improvements or mistakes I can correct in my code?

Here is my HTML form:

<form id="frmRegister" action="dbase/insert.php" method="post" >
<table>
    <tr>
        <th><br /></th>
        <td><br /></td>
    </tr>
    <tr>
        <th align="left">First Name:</th>
        <td><input type="text" name="FirstName" /></td>
    </tr>
    <tr>
        <th align="left">Last Name:</th>
        <td><input type="text" name="LastName" /></td>
    </tr>
    <tr>
        <th align="left">Email Address:</th>
        <td><input type="text" name="Email" /></td>
    </tr>
    <tr>
        <th align="left">Phone Number:</th>
        <td><input type="text" name="Phone" maxlength="10"/></td>
    </tr>
    <tr>
        <th align="left">Username:</th>
        <td><input type="text" name="Username" maxlength="10"/></td>
    </tr>
    <tr>
        <th align="left">Password:</th>
        <td><input type="password" name="Password" maxlength="10"/></td>
    </tr>
    <tr>
        <th align="left">Re-Enter Password:</th>
        <td><input type="password" name="Password2" maxlength="10" /></td>
    </tr>
    <tr>
        <th><br /></th>
        <td><br /></td>
    </tr>
    <tr>
        <td align="center"><input type="button" name="btnSubmit" value="Submit" onclick="Validate();"/></td>
        <td align="center"><input type="reset" value="Reset" /></td>
    </tr>
</table>
</form>

Here is my PHP code:

<?php
// Connect to MySQL
$db = mysql_connect("", "nemo008", "CimesFungo");

if (!$db)
{
    exit("Error - Could not connect to MySQL");
}

$er = mysql_select_db("cs329e_fall11_nemo008", $db);

if (!er)
{
    exit("Error - Could not select the database");
}

$query = "INSERT INTO tblMembers (Username, Password, FirstName, LastName, Email, Phone, Year, Major)
VALUES ('$_POST[Username]', '$_POST[Password]', '$_POST[FirstName]', '$_POST[LastName]', '$_POST[Email]','$_POST[Phone]','$_POST[Year]','$_POST[Major]')";

$result = mysql_query($query);

if (!$result)
{
    print("Error - The query could not be executed");
    $error = mysql_error();
    print("<p>:" . $error . "</p>");
    exit;
}

echo("1 record added");

?>
  • 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-05-27T03:57:40+00:00Added an answer on May 27, 2026 at 3:57 am

    The button type for the submit is wrongly defined.
    It should be :-

    <input type="submit" ...// instead of type="button"
    

    You can take a look how the input tag works :- https://developer.mozilla.org/en/HTML/Element/input

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've generated the following XSLT file, and have created a Form that will post
We have got an extjs 3.1.1 form with file upload field ( http://www.extjs.com/deploy/dev/examples/form/file-upload.html from
I have an HTML form where I am going to copy values from a
I have three simple html or php file that I'm going to create. What
I have a HTML/PHP form using using post to send form data to a
I have a html form for uploading a file, which is as follows: $uploadhtml
I have an HTML form - with PHP, I am sending the data of
I have a HTML form, and I have a Controller Action that accepts the
I have a html form which have a select list box from which you
I have working script that the user completes inputs on a form and when

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.