A drop-down year list to display different categories books.

4 posts by 3 authors in: Forums > CMS Builder
Last Post: April 28, 2013   (RSS)

By esupport - April 18, 2013

Hi 

I added a drop-down year list field for my book cover categories (Multi Record).

On the year dropdown list. When I choose a year.

It can go to the year book category.

How can I coding the PHP code on front site for this feature?

Below is my code now (HTML)

<form name="form" id="form">
<select name="jumpMenu" id="jumpMenu">
<option value="#">Choose a year</option>
<option value="book-cover.php">2013</option>
<option value="book-cover.php?page=2">2012</option>
<option value="book-cover.php?page=3">2011</option>
<option value="book-cover.php?page=4">2010</option>
</select>
<input type="button" name="go_button" id= "go_button" value="Go" onclick="MM_jumpMenuGo('jumpMenu','parent',0)" />
</form>

Thanks!!

Jac

-Jax H.

By esupport - April 28, 2013 - edited: April 28, 2013

Hi Gerg

I try many times.  I just confused how to get my database.

getListOptions('myTableName','myFieldName')  <------ Nice!

It wonderful now!

Share my code for reference :

<form method="get" action="birds_mag_list.php" >

   <?php $options = getListOptions('birds_mag_list', 'list'); ?>

     <select name="list">

       <option value="">&lt;select&gt;</option>

          <option value="">Any</option>

            <?php foreach($options as $value => $label): ?>

          <option value="<?php echo $value; ?>" ><?php echo $label; ?></option>

     <?php endforeach; ?>

    </select>

   <input type="submit" name="go_button" id="go_button" value="Go" onclick="MM_jumpMenuGo('jumpMenu','parent',0)" />

</form>

Thanks a lot!

Jac

-Jax H.

By Mikey - April 28, 2013

Have a look at this thread. I think it's exactly what you're looking for and it's a great solution for providing years in a drop down, because you do not have to hard code your options.

In response to: [url "https://www.interactivetools.com/forum/forum-posts.php?postNum=2207818#post2207818"]Re: [zick] Listing Records that have Multiple Category Options[/url], ...