creating drop down menu

5 posts by 2 authors in: Forums > CMS Builder
Last Post: July 23, 2014   (RSS)

By willydoit - July 21, 2014

Hi all,

I want to create a drop down menu which shows a list of titles of articles and links to the detail page for each article.

My table is called history and it contains a field called "title" (which contains the title of the article.) I have created a list field called titles which auto populates from the title field of each record so as to provide a drop down list of all article titles.

I have uploaded a screen dump showing my settings for the list field "titles"

I have the following code in place however when I load the page in a browser and select a title from the drop down list and press the show page button nothing happens.

 Any help to ascertain why it isnt working and a potential fix would be appreciated. I have obviously missed some important element but dont know what.

My guess is that I somehow need to turn the titles created in the drop down box to hyperlinks incorporating the <a href="<?php echo $record['_link'] ?> element but am not sure how to do this

By the way I am not a programmer so explanations using words of one syllable would be appreciated.

Thanks in advance for any help provided.

<form method="post" action="history_detail.php">


       <h3>History Menu</h3>

       <select name="titles">
        <?php foreach (getListOptions('history', 'titles') as $value => $label): ?>

<option value = "<?php echo $value;?>" <?php selectedIf($value, @$_REQUEST['titles']);?>>

<?php echo $label; ?></option>

<?php endforeach ?>



         </select>
<br/>


        <div align="center">
          <input type="submit" name="search" value="  Show Page  "/>
        </div>



</form>

Attachments:

options.JPG 58K

By claire - July 23, 2014

I think what you want is a dropdown menu of the kind used in headers, instead of a dropdown select.

Check out this link for a simple example using Javascript - http://javascript-array.com/scripts/simple_drop_down_menu/

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By willydoit - July 23, 2014

Hi Claire,

No that isnt what I want, I want the options in the menu to be created dynamically from the table so as new records are added to the table they are automatically added to the menu. The menu labels need to somehow link to the detail page.

I think the procedure required could be closely linked to the list menu that Ross is working on for us for the blogs page but should be simpler as it is all working from one table..

By willydoit - July 23, 2014 - edited: July 24, 2014

Hi Claire,

Thanks for that I will have a further look