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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:32:51+00:00 2026-06-16T18:32:51+00:00

I am creating a report function were a manager can look up amendments to

  • 0

I am creating a report function were a manager can look up amendments to a user rota which is a mySQL table. This contains 5 columns Unique_ID ( Auto Increment), UserID(13 digit number), Date effected(Unix date), Date added(Unix date), Added_by(13 digit number).

To select the the correct data i was populating a drop down from another table which contains username and UserID ( a 13 digit number) however i am stuck with how to select the name ( as no one can remember all staff numbers) and it POST the corresponding user id to the next query.

<form action="<?=$_SERVER['php_SELF']?>" method="get">
<?
    $loc = $usersite->UserLocation();
    $username = "Uname";
    $password = "Pword";
    $hostname = "Hname";
    $dbhandle = mysql_connect($hostname, $username, $password)
        or die("Unable to connect to MySQL");
    $selected = mysql_select_db("DBname",$dbhandle)
        or die("Could not select database");
    $query="SELECT name FROM `login1st` WHERE `Location` = '$loc'";
    $result = mysql_query ($query);
    echo "<select name=category value=''></option>";
    while($nt=mysql_fetch_array($result)){
        echo'<option value="'.$nt['name'].'">'.$nt['name'].'</option>';
    }
    echo "</select>";
?>
<input type="submit" value="Search" class="buttons2">
</form>

this work fine and i have a drop down box with all staff names, is there a way to get the associated userid from the selection to a separate query? E.G

    SELECT * FROM  `$loc` WHERE  `User_id` = (query result from drop down)

i am using the PHP_SELF as the result, I am hoping, will go into a table below the drop down. i am open to any other ways of doing this. Thanks in advance.

  • 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-16T18:32:52+00:00Added an answer on June 16, 2026 at 6:32 pm

    in the value-section you can define what to submit. So just change your query to get the UserId as well

    $query="SELECT UserID, name FROM `login1st` WHERE `Location` = '$loc'";
    

    and then just output the id in your selectbox:

    echo'<option value="'.$nt['UserID'].'">'.$nt['name'].'</option>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql legacy table which contains an client identifier and a list
I'm creating a report in php in which 6 html drop downs appear and
I'm working on creating a tabular report of some information on a website. This
I'm creating a jasper report which has the parameters of datetrfrom and datetrto .
I'm creating a report system which uses a meta question model to create the
I'm creating a forum for a website, and plan on implementing a Report this
I am creating a daemon process. This process depends on MYSQL, however my process
I am creating a report in SSRS 2005 and where there should be a
I am creating a report such that when you click on a data point
I'm creating a report that will take some data from one database (Company and

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.