Hi
Just purchased a copy of chronoforms and almost finished my form and I am very happy with the product so far.
I am now trying to get some of my fields from a eventlist table to be put into a dropdown list. I have seen earlier posts about this but I cannot seem to get anything working. I am probably doing something really wrong. Most of the code I have tested will only leave me with a 403 forbidden access upon trying to save the form.
What I really like to have is a dropdown box that lists the events and the start and finish date of the event on each row in the dropdown list.
$sql = "SELECT `dates`, `enddates`, `title` FROM `walk`.`jos_eventlist_events` LIMIT 0, 30 ";
This is the query that I run to get the info from phpmyadmin.
Many thanks in advance.
//C
Just purchased a copy of chronoforms and almost finished my form and I am very happy with the product so far.
I am now trying to get some of my fields from a eventlist table to be put into a dropdown list. I have seen earlier posts about this but I cannot seem to get anything working. I am probably doing something really wrong. Most of the code I have tested will only leave me with a 403 forbidden access upon trying to save the form.
What I really like to have is a dropdown box that lists the events and the start and finish date of the event on each row in the dropdown list.
$sql = "SELECT `dates`, `enddates`, `title` FROM `walk`.`jos_eventlist_events` LIMIT 0, 30 ";
This is the query that I run to get the info from phpmyadmin.
Many thanks in advance.
//C
Hi Clinden,
Here's an example of code like that. This creates a category drop-down but the principles are the same
Bob
Here's an example of code like that. This creates a category drop-down but the principles are the same
<?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='' >==?==</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>
Note: $d->cat_id is the currently set value.Bob
Hi
Many thanks !!!
I can now see my events in the drop down list. Is there a way to get the date also of the tour next to the tour name. I have been trying with changing the option value but no luck.
This is the code I am using.
Thanks again !
Many thanks !!!
I can now see my events in the drop down list. Is there a way to get the date also of the tour next to the tour name. I have been trying with changing the option value but no luck.
This is the code I am using.
<?php
$db =& JFactory::getDBO();
$query = "
SELECT `id`, `title`, `dates`
FROM `#__eventlist_events`
ORDER BY `title`
";
$db->setQuery($query);
$categories = $db->loadObjectList();
$cat_options = array();
$cat_options[] = "<option value='' >Please select</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>
Thanks again !
Hi clinden,
Please try:
Bob
Please try:
$cat_options[] = "<option value='{$c->id}' {$selected} >{$c->title} {$c->dates}</option>";
Bob
Hi again
Forms working and all events is listed, but once the selected event is chosen then sending this info on using the curl addon then it sends the ID of the event on not the selected event name and date. Is it possible to change this so I get the event + date instead of the ID of the event.
As always many thanks for your help.
Forms working and all events is listed, but once the selected event is chosen then sending this info on using the curl addon then it sends the ID of the event on not the selected event name and date. Is it possible to change this so I get the event + date instead of the ID of the event.
<?php
$db =& JFactory::getDBO();
$query = "
SELECT `id`, `title`, `dates`
FROM `#__eventlist_events`
ORDER BY `dates`
";
$db->setQuery($query);
$categories = $db->loadObjectList();
$cat_options = array();
$cat_options[] = "<option value='' >Please select</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} {$c->dates} </option>";
}
?>
As always many thanks for your help.
Hi clinden,
Please try changing this line again:
Bob
Please try changing this line again:
$cat_options[] = "<option value='{$c->id}' {$selected} >{$c->title} {$c->dates} </option>";
tp this$cat_options[] = "<option value='{$c->title} {$c->dates}' {$selected} >{$c->title} {$c->dates}</option>";
Bob
This topic is locked and no more replies can be posted.