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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:56:55+00:00 2026-05-26T20:56:55+00:00

can someone tell me how to insert the selected text not the value of

  • 0

can someone tell me how to insert the selected text not the value of a dropdown list (select box) into a mysql database when user hits the button enroll. The code right now inserts the id of the row i am rendering but I need to insert the value. Sorry if I am not that explanatory.. Much help is appreciated. !!!

Updated: Can Someone tell me how to redirect after succesfulling inserting to a confirmation page ?????

$db = &JFactory::getDBO();

$query = "
INSERT INTO
`jos_jquarks_persontraining`
(

course_name,

courseDate,

user_id,
employeeNumber,
department,
name,
timeStamp
)
VALUES
(

'{$courseTitle}',
'{$varcourseDate}',

'{$id}',
'{$username}',
'{$department}',
'{$name}',
'{$acknowledge}',
'{$vardate}'
)";

$db->setQuery($query);

$db->query();

if($db->getErrorNum()) { 
JError::raiseError( 500, $db->stderr()); 
} 

}

?>

 <form name="quiz_info" method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">

<?php

echo JText::_('Please select the date:');

$database= &JFactory::getDBO();

$database->setQuery('SELECT training_id,CONCAT(trainingDate,"-",trainingHour) AS trainingDate FROM training WHERE openSeats > 0');


$result = $database->loadObjectList();



echo '<select name="dateSelectBox">';
foreach ($result as $row) {

echo '<option value="'.$row->training_id.'">'.$row->trainingDate.'</option>';
                        }
echo '</select>';
  • 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-26T20:56:56+00:00Added an answer on May 26, 2026 at 8:56 pm

    Just use

    echo '<option value="'.$row->trainingDate.'">'.$row->trainingDate.'</option>';
    

    on the third last line, but the whole method looks quite fishy to me.

    1. You should really use ID’s of the training dates instead of the dates themselves, it’s better design
    2. You are not reducing the number of open seats in the code. Anyway, try designing your DB to include “capacity” column, you can then check for open seats in more consistent way.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

there is insert iterator in database template library or other library, Can someone tell
Can someone tell me which data structure supports insert/delete/maximum operation in O(1)?
Something went wrong with my code. The insert code does not work. Can someone
Can someone tell me, when you for example update, insert, delete.. should you then
If someone can tell me what I'm doing wrong it'd be great. If not,
I seem to be going wrong somewhere in this INSERT query. Can someone tell
Can someone tell me why this processes all the files and then does it
Can someone tell me why when I cast a string of say 00332 I
Can someone tell me how I can make a table be 100% height in
Can someone tell me the difference between: $(document).ready(function() { }); and: var someVar =

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.