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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:32:09+00:00 2026-05-20T20:32:09+00:00

I need a HTML-based form to tie database records together. The user scenario that

  • 0

I need a HTML-based form to tie database records together. The user scenario that I envision is somthing like this:

A super-user does a search of the database and is delivered a table of records based on that search; each record is numbered with the database-record id.

There would also be two text fields next to each record. These text fields would allow:

  1. the user to make a reference from one record to another. For example, a user could enter into record id #457 the integer 242 to indicate that there is a correlation with record ID #242.
  2. The user would also describe the type of relationship it is. This could be accomplished with a simple integer in the second field that indicates the type of relationship between the two records.

When the super-user hits the submit button, all of these relationships are saved in a mySqljoin table.

One option is to give me advice on how to implement and code this myself in PHP. However, before I reinvent the wheel, another option is to lead me to a free script that does something similar.

  • 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-20T20:32:09+00:00Added an answer on May 20, 2026 at 8:32 pm

    If you’re just looking for a pseudo-code framework, I would do it something like this for the body of the form:

    <form id="my_form" action="" method="post">
    <table id="my_table"><tr><th>Result ID</th><th>Related ID</th><th>Relation Type</th></tr>
    
    <?php
    $result = mysql_query("SELECT blah blah");
    while ($row = [your chosen method of fetching results]) {
        $resource_id = $row['id'];
        echo "<tr><td>".$resource_id."</td>";
        echo "<td><input type=\"text\" name=\"related[".$resource_id."]\" /></td>";
        echo "<td><input type=\"text\" name=\"type[".$resource_id."]\" /></td></tr>";
    }
    ?>
    </table>
    <input type="submit" value="Submit Related Resources" />
    </form>
    

    And then when the user submits the form, process it with another loop that goes through each value in the related and type arrays and submits a mysql_query(“INSERT blah blah”). For example:

    $related_resources = $_POST['related'];
    $related_types = $_POST['type'];
    foreach ($related_resources as $original_resource -> $related_resource) {
        $type = $related_types[$original_resource];
        mysql_query("INSERT INTO [table name] ('resource', 'related', 'type') VALUES ('".$original_resource."', '".$related_resource."', '".$type."'");
    }
    

    Of course you should also add an “if in_array” etc. before getting the type to make sure the user entered one and store a default if not, or check the form for completeness before processing it if you want to require them to fill in both fields. You should also run your input through a safety function (escaping quotes etc.) before letting any users input data into your tables.

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

Sidebar

Related Questions

I have a third-party app that creates HTML-based reports that I need to display.
I need to sanitize HTML submitted by the user by closing any open tags
Based on: MVC Html.CheckBox and form submit issue Let's consider following example. View: <%
I have an html form in a view that needs to be reset from
I am building a dynamic form in that the user can keep adding entries
I need to convert HTML documents into valid XML, preferably XHTML. What's the best
I need to layout a html datatable with CSS. The actual content of the
I need to capture the HTML and do some post processing on the HTML
I need to catch the HTML of a ASP.NET just before it is being
I need to convert a Word document into HTML file(s) in Java. The function

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.