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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:07:53+00:00 2026-05-29T08:07:53+00:00

<?php $id = $_SESSION[‘user_id’] ; echo <form method=’post’ action=’#’>; echo </select> <p>Which Hospital Would

  • 0
<?php
$id = $_SESSION['user_id'] ;
echo "<form method='post' action='#'>";
echo "</select>
<p>Which Hospital Would You Like to Submit To?</p>";
$queryitem  = "SELECT * FROM vendor_hospital WHERE vendor_hospital.user_id = '$id' AND vendor_hospital.approval_status = '1'" or die('MYSQL error: ' . mysql_error());
if ($result = mysql_query($queryitem)) {
    if ($success = mysql_num_rows($result) > 0) {
        echo "<select name='hospital_name'>";
        echo "<option>-- Select A Facility --</option>";
        while ($row = mysql_fetch_array($result))
        echo "<option value='$row[manufacturer_id]'>$row[manufacturer_id]</option>";
        echo "</select><br><br>";
    } else {
        echo "No results found.";
    }
} else {
    echo "Failed to connect to database.";
}
echo "<input type='submit' value='Submit' name='submit' class='button' /></form>";
?>

For some reason I’m stuck here. I’m just trying to get the manufacturer name to show in my options instead of the manufacturer_id. The manufacturer name is a foreign key in another table so I can’t simply call $row[manufacturer_id] in my option tag. What should I do here? My only thought is to run a query inside the option tag for every manufacturer_id listed as a value but I’m sure that is overkill. Can someone point me in the right direction of a more elegant solution than that?

  • 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-29T08:07:53+00:00Added an answer on May 29, 2026 at 8:07 am

    Not really sure what you are trying to do…but try this.

    Replace this:

    while ($row = mysql_fetch_array($result))
    echo "<option value='$row[manufacturer_id]'>$row[manufacturer_id]</option>";
    echo "</select><br><br>";
    

    With this:

            while ($row = mysql_fetch_array($result)){
            echo "<option value='".$row['manufacturer_id']."'>".$row['manufacturer_id']."</option>";
    }
            echo "</select><br><br>";
    

    Also be sure to double check and make sure that you are pulling from the right database, that it is populated, you are calling the right table names, etc…

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

Sidebar

Related Questions

<?php session_start(); if (count($_POST) > 0) { $_SESSION['link'] = $_POST['link']; } ?> <form method=post>
index.php session_start(); if(!isset($_GET['n'])) { $_SESSION['foo'] = bar; header(Location: /index.php?n=D); } echo FOO: .$_SESSION['foo']; This
Is there a way to catch the contents of the PHP session variable $_SESSION['user_id']
here is the code <?php session_start(); if(!isset($_SESSION['user_name'])) { header('Location: login.php'); } $conn = mysql_connect(localhost,
when I run this code for the first time <?php session_start(); echo SID; ?>
The php and html are pretty simple: <?php session_start(); $_SESSION['liked_or_not']=0; ?> <button class=photo_like value=<?php
session_1.php <?php session_start(); $_SESSION[0]['uid'] = 1; $_SESSION[0]['uname'] = n1; $_SESSION[1]['uid'] = 2; $_SESSION[1]['uname'] =
Index.php <?php session_start(); require_once('../inc/db/dbc.php'); include('login_helper.php'); ?> <!-- html form --> Login/Logout Links depending on
I have a PHP application where I set $_SESSION['user']=logged once a user is authenticated.
If I save some object in a php session variable $_SESSION['geoip'] = new GeoIP();

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.