i create a website where the article of joomla are a courses, i need and i dont' know if is possible to do this:
when the user is in the article (courses) can subscribe register to it, with a standard form of chronoform :name, email pass etc ..but in the form i need that the first field must be the name of the articles of joomla automatically ( the name of the courses) ..i can do this ? and if yes can help me?
i think that we can insert the latest news of joomla in a dropdown that include automatically the last item of a spefic category ( the name of the courses ) but i dont' know how and if is possible
thanks
i'm sorry bob ..i have tried and tried again.. but appear only a dropdown blank
i have insert this in the code form with javascritp
<?php
$db =& JFactory::getDBO();
$query = "SELECT `id`, `title`
FROM `#__content`
WHERE `catid` = '39'
ORDER BY `publish_up` DESC ;";
$db->setQuery($query);
$data = $db->loadObjectList();
$options = array('' => '==?==');
foreach ( $data as $d ) {
$options[] = "<option value='{$d->id}' >{$d->title}</option>";"
?>
in the code form html i insert
<select name="select" size="1" id="select">
<?php echo implode('', $options); ?>
</select>
</tr>
</table>
<div align="center">{imageverification}
</div>
<p align="center">
<input name="Submit" type="submit" class="chronoform" value="Invia" /></p></td>
</tr>
</table>
sorry but i dont' know the php🙂 and so i dont' know where the mistake
:) thanks bob for your help
now it work
thanks very much
grey i need your help again
..in this way ..in the form are shows all the item ..published and no ....how can i insert the query to show onlye the item published or that appear on home page?
i think i have to insert AND published ='1' but i dont' know where
the other problem is that in the email i received appear only the number of the items but not the title
tks
sorry but not work, the dropdown now is blank
<?php
$db =& JFactory::getDBO();
$query = "SELECT `id`, `title`
FROM `#__content`
WHERE `catid` = '39' AND `published` = 1
ORDER BY `publish_up` DESC ;";
$db->setQuery($query);
$data = $db->loadObjectList();
$options = array('' => '==?==');
foreach ( $data as $d ) {
$options[] = "<option value='{$d->id}' >{$d->title}</option>";
}
?>
the second question is that when i recived the form by email ..there are not the title of the articles but only the number
thanks bob
Hi simonetta,
Are there any articles WHERE `catid` = '39' AND `published` = 1 ??? The SQL looks good so the next thing to check is to test in PHPMyAdmin to see what results it should give*.
And, yes, this code returns the article ID. You haven't actually said what you want to do with the result and the ID is the most useful value to return.
You can return the Title if you prefer; or look the title up from the ID before the email is sent.
Bob
* I just checked the jos_contents table and there is no `published` column. It is `state` in this table.
this is the code that work
<?php
$db =& JFactory::getDBO();
$query = "SELECT `id`, `title`
FROM `#__content`
WHERE `catid` = '39' AND `state` = 1
ORDER BY `publish_up` DESC ;";
$db->setQuery($query);
$data = $db->loadObjectList();
$options = array('' => '==?==');
foreach ( $data as $d ) {
$options[] = "<option value='{$d->title}' >{$d->title}</option>";
}
?>
<select name="select2" id="select">
<?php echo implode('', $options); ?>
</select>
to receive the title in the email of the form i modify this
$options[] = "<option value='{$d->title}' >{$d->title}</option>";
work ..but is right?
thanks
Hi simonetta,
Try it and see.
Bob
i have tried and it work🙂
thank very much bob for your patience