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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:36:28+00:00 2026-05-17T01:36:28+00:00

I am going back though a web-based document numbering system from few weeks ago.

  • 0

I am going back though a web-based document numbering system from few weeks ago. To sum it up, the user types in the project,class,base, and dash number (PPP-CCC-BBBB-DDD) then it is added to a mysql database. Now most doc numbers go in order according to revisions. IE: A document 1465-630-0001-000 becomes, after revision, 1465-630-0002-000.

The boss wants the system to automatically fill the input text box for the base number if it detects that the user is entering a revised doc. So if a user types in 1465 into the project field and 630 into the class field the system should autofill the base field with the next available number. In the previous example this would be 0002.

It needs to be able to search the database for the first two fields so that it can find the next available one. Is there anyway to do this using javascript or something? SO was really helpful with my last javascript question pertaining to this system.

heres an bit of my code if it helps:

` ?>

<div id='preview'></div>
<form id='item' action="submit.php?item=1" method="post">
Enter Title:<input type="text" name="title" size="20"><BR>

Choose Project Code:
<SELECT NAME="project">
        <OPTION VALUE="">Project...
        <?
        $query  = "SELECT * FROM project ORDER BY project asc";
        $result = mysql_query($query);
        while($row = mysql_fetch_assoc($result))
            {
            $num = ($row['project']);
            $name = ($row['description']);
            ?>
            <OPTION VALUE="<?=$num?>" ><? echo"{$num}" . " | " . "{$name}";?>
            <?
            }
            ?>    
</SELECT><BR>

Choose Class Code:
<SELECT NAME="class">
            <OPTION VALUE="">Class...
        <?
        $query  = "SELECT * FROM class ORDER BY class asc";
        $result = mysql_query($query);
        while($row = mysql_fetch_assoc($result))
            {
            $num = ($row['class']);
            $name = ($row['description']);
            ?>
            <OPTION VALUE="<?=$num?>" ><? echo"{$num}" . " | " . "{$name}";?>
            <?
            }
            ?> 
</SELECT><BR>

Assigned Base Number:<input type="text" name="base" size="20"><BR>
Enter Dash Number:<input type="text" name="dash" size="20"><BR>
Enter Comments:<input type="text" name="comment" size="40"><BR>
<input type="hidden" name="item" value="1"/> `

Just a simple html/php input form with the project and class code list generated from a database pertaining to each.

Thanks for any help-Thomas

  • 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-17T01:36:28+00:00Added an answer on May 17, 2026 at 1:36 am

    Update:
    So, you’re going to need to make an AJAX call (see example in my comment below) to some PHP script that will retrieve the base value you want and then returns that to the AJAX request. Once the request gets a response, you can use that data to fill in the value the way I originally said…

    On a side note, since the example I gave you is a jQuery AJAX function, you should probably check out how to use jQuery to select elements on the page, instead of using straight JS.

    E.g. for getting by ID and replacing value:

        $("#base").attr('value', valueFromAjaxCall);
    

    How to change value with JS:
    If you use PHP to get the base value you want to fill into the field, then you can fill the value in with:

        var baseField = document.getElementsByName("base")[0];
        baseField.value = <?=$baseValue?>;
    

    The getElementsByName() call returns an array, which is why you have to index into the field you want. I would suggest giving your <input> an id so that you can use document.getElementById() instead. You would do something like:

        <input type="text" id="base" size="20">
    

    and the JS to get the input element would be:

        var baseField = document.getElementById("base");
    

    …therefore, no need to index, in case you named any fields with the same name.

    **Not sure about the PHP syntax.

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

Sidebar

Related Questions

How do I stop my application from going back when the user clicks on
I'm going back through one of my old apps (my first, actually), and am
I'm going back over an old project where I added preprocessor functionality to Essence'
I see a lot of debate going back and forth on which language to
I have 100+ GB of photos going back 25 years. They are arranged in
I have 51 GB of HTTP (Apache) access logs for my website going back
This is me going right back to basics with TDD for learning purposes. I
Not sure what's going on here, but my iPhone apps nav bar shows back
I have a PHP script that works by calling items from a database based
I'm working on a web service that fetches data from an oracle data source

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.