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

  • Home
  • SEARCH
  • 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 8045219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:28:44+00:00 2026-06-05T05:28:44+00:00

I am building a website form in HTML that I want to gather information

  • 0

I am building a website form in HTML that I want to gather information from users, and store it in MySQL. However, when I submit the form after entering the information, the PHP script is not executed. It simply displays the PHP script in raw form. In a browser, it downloads the PHP file.

At first, I was lead to believe that this was an issue with my MySQL, PHP, Apache configuration, but after following this step by step, I still cannot execute the PHP script.

My form’s header looks like so:

<form id="form-settings" method="post" action="file.php">

file.php being the script I want to execute upon submission.

Here is my PHP script:

<?php
error_reporting(E_ALL);

$link = mysql_connect("localhost","username","password");

if (!$link) 
{
       die('Not connected : ' . mysql_error());
}

mysql_select_db("mysql", $link) or die("Unable to select database");

$var1=$_POST['var1'];
$var2=$_POST['var2'];
$var3=$_POST['var3'];
$var4=$_POST['var4'];
$var5=$_POST['var5'];

$query = "INSERT INTO table VALUES ('','$var1','$var2','$var3','$var4','$var5')";
mysql_query($query);

mysql_close($link); ?>

I can execute PHP files from the Terminal fine. I can query my MySQL table and enter info into it, but when I try to run it via the HTML form, it doesn’t work. The Vars are values pulled form the HTML form. Any advice would be greatly appreciated. Obviously, the php is not being recognized, but where does this issue arise from?

  • 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-05T05:28:46+00:00Added an answer on June 5, 2026 at 5:28 am

    (i would post this as a comment, but i can’t because I’ve got too little karma…)

    Have a look at the logfiles, especially the error log files. They are probably in /var/log/apache2 or something. See if there is something wrong?

    Is your phpinfo()-script in the same directory as the other script? Are you accessing the script with the same hostname? (127.0.0.1 vs. localhost, for example?)

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

Sidebar

Related Questions

Building a website that has English & Japanese speaking users, with the Japanese users
I'm building a form in Drupal that needs to submit to a 3rd party
I'm building a website using AngularJS and Rails. The HTML files that I'm using
I'm building a website that uses jQuery for things like Modals and form validation.
I'm building a website where users can upload images. I don't want to use
I am using an html sign up form for a website I'm building. The
I am building a mobile website, In this a form is there but no
I'm building a simple contact form for a website. It does not connect to
I'm building a wholesale order form on a website. The current plan is to...
I am building a website to capture data. I have many spreadsheets that are

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.