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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:11:15+00:00 2026-06-04T07:11:15+00:00

I have a form with a select box where the user can select pre-existing

  • 0

I have a form with a select box where the user can select pre-existing fields from a database:

<form action='' method='POST' autocomplete='off' enctype="multipart/form-data">
  <p><strong>Title and Description:</strong></p>
  <select name='uidtitle' class='chosen-select'>
  <option value="0" ></option>
    <?php 
      $result = $mysqli->query("SELECT uid, title, description FROM tblFacilityHrs") or die($mysqli->error);
      while ($row = $result->fetch_array(MYSQLI_ASSOC)){
        echo "<option value=\"1\">" . $row['title'] ." - " . $row['description'] . "</option>";
        $uid = $row['uid'];
        $title = $row['title'];
        $desc = $row['description'];
      }
    ?>
    </select>
...

How can I send all three of those values (separately) to my postback for SQL?

if (isset($_POST['submitted'])) { 
  //Get params for prepared statements
  $startDatec= date("Y-m-d H:i:s", strtotime($_POST['startEventDate']));
  $endDatec= date("Y-m-d H:i:s", strtotime($_POST['endEventDate']));
  $startTimec=$_POST['startTime'];
  $endTimec=$_POST['endTime'];
  $recurc=$_POST['recurrence'];
  $finalc= date("Y-m-d H:i:s", strtotime($_POST['finalDate']));
  ...
  • 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-04T07:11:15+00:00Added an answer on June 4, 2026 at 7:11 am

    I have no idea why you would need to send all three values back. Database Keys exist for the reason of being able to identify ALL fields in a record given just a single field, in this case I’m assuming uid. Passing that field alone would allow you to select the other fields in your postback before performing the operation that you intend.

    However, it is possible using hidden form fields, although I don’t advocate this approach.

    <select name='uidtitle' class='chosen-select'>
      <option value="0" ></option>
        <?php 
          $result = $mysqli->query("SELECT uid, title, description FROM tblFacilityHrs") or die($mysqli->error);
          $cacheArray = array(); // Used to store the information to be used below
          while ($row = $result->fetch_array(MYSQLI_ASSOC)){
            echo "<option value=\"" . $row['uid'] . "\">" . $row['title'] ." - " . $row['description'] . "</option>";
              $cacheArray[] = $row;
          }
        ?>
        </select>
    
    <?php
    
        foreach($cacheArray as $k => $v) {
            echo '<input type = "hidden" name = "title-' . $v['uid'] . '" value = "' . $v['title'] . '">';
            echo '<input type = "hidden" name = "description' . $v['uid'] . '" value = "' . $v['description'] . '">';
        }
    
    ?>
    

    The hidden form fields will be present for all records in your tblFacilityHrs table. The names are made distinct by appending the uid to the name. You can determine what fields you are interested in in your postback by:

    $_POST['title-'.$_POST['uidtitle']]
    $_POST['description-'.$_POST['uidtitle']]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following multi-select box in a HTML form, where user can select
The select form component in grails can have the form: <g:select name=user.age from=${0..59} value=${age}
I have a form where a user can select a rating from 1-5. Each
I have a html form which have a select list box from which you
I have a form where a user can add multiple select boxes for multiple
I am using C# here. I have a form where the user can select
I have a form with an input box where the user can specify their
i have a select box to allow the user select what kind of form
i have one form which have some input box and some select box. i
I have a form in a .html files where input/select box looks like this

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.