populating a drop down list

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 29, 2008   (RSS)

By Chris_t - February 28, 2008

Hey Dave, well now that I have the categories list working I am feeling pretty cocky.

Let see if I can do this, the clients wants a drop down list of all the business that are listed in the coupon menu so we have a title field in the coupon menu with there name and we need to link it to there couponPage.php any thoughts would be great.

I came into work today sick and not wanting to work but after getting the menu to work so fast I feel a whole lot better [:)] Thanks Dave.

Re: [ChrisTitchenal] populating a drop down list

By Dave - February 28, 2008

The first step is always to figure out what kind of output you need. I'm thinking you want something like this:

<form method="get" action="couponPage.php">
<select name="title">
<option>Business Name Here</option>
<option>Business Name Here</option>
<option>Business Name Here</option>
</select>
</form>


The simplest would probably just be another list viewer that outputs just business names.

Just hardcode the options to list everything (per page = 1, pagenum = 1, where = 1, etc) and develop it on a separate page with nothing else before cutting and pasting it over. It will go a lot faster that way.

Would that work for you? See how far you can get and then post the code (and an url to the test viewer for it) and I'll help you out if you get stuck on anything.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] populating a drop down list

By Chris_t - February 29, 2008 - edited: February 29, 2008

Thanks Dave, I have the list being populated and built now just 2 questions.

1. can I set it to display all listings on one page insted of telling it a number per page.

2. The search is going to the page view not list view and doing it by title is not working would num work for this.


<form method="get" action="couponPage.php">
<select name="">
<?php foreach ($listRows as $record): ?>
<option value="<?php echo $record['title'] ?>-<?php echo $record['num'] ?>"> <?php echo $record['title'] ?> </option>
<?php endforeach ?>
</select> <input type="submit" value="Search"> </form>





I can get really close but the link it makes says

http://clikquikcoupons.com/proof/couponPage.php?=AAMCO-2
when it should read
http://clikquikcoupons.com/proof/couponsPage.php?AAMCO-2/

any ideas



Edit found the problem was a typo ugh but my first questions still stands how can I make sure all listings will always be displayed
Thanks Dave you and your php skills rock

Chirs