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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:28:45+00:00 2026-06-04T01:28:45+00:00

I am trying to make a webpage that connects to my SQL database and

  • 0

I am trying to make a webpage that connects to my SQL database and fetches information from a table and place it into a text box. The information it fetches is dependent on what is entered into another text box. Essentially its an “autofill” of information. I was curious whether this was possible.

To create a better understanding here is a layout of text boxes:

<html>
<head>
<?php
$con = mssql_connect("abc", "123", "password");
if (!$con)
  {
  die('Could not connect: ' . mssql_get_last_message());
  }

mssql_select_db("db1", $con);

$result = mssql_query("SELECT * FROM FormData");
<head>

<title>test</title>

</head>

<body>
    <h1>test</h1>

    <form action="#">

        <p>Enter ID</p>

        <input type="text" name="ID"/> 
        <input type="text" name="NAME"/> 
        <input type="text" name="LASTNAME"/> 
        <input type ="button" value="submit" onclick="check(ID)" />



    </form>
</body>

Here an ID would be entered into a text box and then once the submit button was pressed, it would fetch the rest of the information from my sql database into the next boxes. I don’t even know whether this is possible, whether I can use Javascript in conjunction with this or something. I searched but couldn’t find much help on the subject.

I’m not even sure if its possible to do “if” statements within SQL – whenever I try I end up with a 500 error due to improper syntax.

  • 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-04T01:28:47+00:00Added an answer on June 4, 2026 at 1:28 am

    If I understand you correctly, all you need to do is on the submission of the form capture the ID they entered.

    If the ID has not been submitted yet (either their first time hitting the page, or they failed to enter an ID) you should not perform any query and create a blank $row array like so:

    $row = array("ID" => "", "NAME" => "", "LASTNAME" => "");
    

    You should then fill your form fields using this array <input type="text" name="NAME" value="<?php echo $row['NAME']; ?>"/>.

    If the ID has been submited you then use this ID in your SQL query "SELECT * FROM FormData WHERE ID = $_POST['ID']" (Note: This is an example. You will need to escape the POST data to prevent SQL injection).

    You need to then pull this result into your $row array $row = mysql_fetch_row($result) which in turn is used by your fields to populate the value.

    This entire procedure could be done with AJAX so that you don’t have to perform a full page submit however based on your example the solution I have provided should be good enough.

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

Sidebar

Related Questions

I'm trying to make a program that fetches information from this webpage, www.sio.no ,
I am trying to obtain some information from a webpage that requires login. I
I am trying to make a webpage so that content will only be visible
I am trying to make a function that returns the content of the webpage
I am trying to make a webpage that uses a moving div that slowly
I'm trying to make a webpage that allows the uploading of multiple files at
I am trying to make a proxy server that gets a page from www.xxx.com
I am trying to make a request to a webpage that requires cookies. I'm
So i'm trying to make a webpage, that launches local applications through a client.
I'm trying to make a web scraper that will parse a web-page of publications

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.