Hi Guys,
Below you see a working dropdown selectbox voor CF v4. As the code is know it only saves the "TITLE" in a DB FIELD (producten).
But i also wan't to save the "ID" in a DB FIELD when selecting a product and not only the "TITLE".
How do i solve this?
Regards
Ritchie
Below you see a working dropdown selectbox voor CF v4. As the code is know it only saves the "TITLE" in a DB FIELD (producten).
But i also wan't to save the "ID" in a DB FIELD when selecting a product and not only the "TITLE".
How do i solve this?
Regards
Ritchie
<select size="1" type="select" name="producten">
<option value="">-------- producten --------</option>
<?php
$db =& JFactory::getDBO();
$query = "SELECT id,title FROM lw0bd_faqbook_items ORDER BY title";
$db->setQuery( $query );
$option = $db->loadObjectList();
foreach ( $option as $o) {
echo "<option value='{$o->title}' >{$o->title}</option>";
}
?>
Or do i have to use something like this http://www.chronoengine.com/forums.html?cont=posts&f=5&t=22394&p=72360&hilit=dropdown+query#p72360?
Is this the way? Bob?
<?php
$db =& JFactory::getDBO();
$id = JRequest::getVar('producten', '', 'get');
if ( $id) {
$query = "
Select title from lw0bd_faqbook_items
WHERE `id` = '".$id."' ";
}
This topic is locked and no more replies can be posted.