Hi,
I created a form to submit an article but I dunno how to send the category.
I used a "custom element PHP/HTML" as Element and I put it before the "Submit Article" to display all the categories. Here is the code:
but now I dunno how to submit the category and save the article with the selected category. Can please someone help me?
Thanks.
I created a form to submit an article but I dunno how to send the category.
I used a "custom element PHP/HTML" as Element and I put it before the "Submit Article" to display all the categories. Here is the code:
<?php
$db =& JFactory::getDBO();
$query = "
SELECT `id`, `title`, `alias`
FROM `#__categories`
WHERE `published` = 1 AND `access` = 1
ORDER BY `title`
";
$db->setQuery($query);
$categories = $db->loadObjectList();
$cat_options = array();
$cat_options[] = "<option value='' >Jobs</option>";
foreach ( $categories as $c ) {
$selected = '';
if ( $ws_id && $d->cat_id == $c->id ) {
$selected = "selected='selected'";
}
$cat_options[] = "<option value='{$c->id}' {$selected} >{$c->title}</option>";
}
?>
<div class="form_item">
<div class="form_element cf_select">
<label class="cf_label" style="width: 150px;">Category</label>
<select class="cf_select" title="" id="cat_id" name="cat_id" >
<?php echo implode("/n", $cat_options); ?>
</select>
</div>
<div class="cfclear"> </div>
</div>
but now I dunno how to submit the category and save the article with the selected category. Can please someone help me?
Thanks.