Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 136,495 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,703 people online right now. Registration is fast and FREE... Join Now!




How to populate web form select list from .LST file?

 
Closed TopicStart new topic

How to populate web form select list from .LST file?

-Monkey-
2 Mar, 2008 - 12:39 PM
Post #1

New D.I.C Head
*

Joined: 2 Mar, 2008
Posts: 2

Hi,

I have some websites with database search forms which pass the form user inputs to a CGI script, which in turn queries an MS Access database on the server (W2K, IIS 5), based on the corresponding database fields the user has searched on. The search rsults are then returned to the user.

The back end database is a photographic image library, which administrators update using the database PC client app. The websites hook into this database, to publish the content to web users.

I have absolutely no control of either the Access database or the CGI script code. I can therefore only edit the HTML for the website.

The question is: Can I populate the web form SELECT lists dynamically from an .LST file that resides on the web server, rather than hard code the list options in the HTML SELECT options?

For example, there is a field called LOCATION in the Access database. On the back end, the Access ListBox values (countries) for the database admin's field dropdown list are stored in a file called LIST1.LST (not sure whether .LST file is native to Access, or whether it's related to VB code that's used in the CGI search engine script - anyway, I know that's where the list values for the database's forms are stored!).

Currently, I have to frequently look at the back end database (using the library administrator's client app) to see what countries are defined in the field list, then manualyy update the website SELECT list options to match. Users can frequently add/remove a list item in the backend database, so this can be a real pain, to users and myself!

I know virtually nothing about PHP (though already using a PHP script to force a Save As dialog when linking to jpeg files, so not completely new). Unfortunately I don't have time to crash learn it right now, so would appreciate if someone could please give me a Lego-like solution here!

So, currently my website HTML code for the form input of the LOCATION field is something like:

<TD>
<SELECT NAME="LOCATION" style="width:217">
<OPTION VALUE="">
<OPTION VALUE="Austria">Austria
<OPTION VALUE="Denmark">Denmark
<OPTION VALUE="Germany">Germany
...

</SELECT>
</TD>


Instead of using hard-coded OPTION values for the dropdown list like this, I want to pull them straight in from the LIST_1.LST file that lives in the database folder on the server.

I opened the LST file in Notepad and can see the country names followed by white space. Each country appears to take up 80 bytes in the file, even though the LOCATION field is only 64 characters long in the Access database, so I guess there are some kind of invisible delimiter characters in there, or hex codes used by Access, not sure. The country names themselves appear fine.

I'd be over the moon if anyone can help thanks. I've spent ages looking already. Ideally, a block of code I can just paste straight into the HTML. Already running PHP 5.

Thanks!









User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: How To Populate Web Form Select List From .LST File?
2 Mar, 2008 - 12:51 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,993



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
Welcome to </dream.in.code> -Monkey-, glad you could make it! Hope to see you around the forums someday smile.gif

For future reference you need to post your programming question in the proper forum so it gets the attention it needs. This forum is for introductions only?

Happy Coding!
User is offlineProfile CardPM
+Quote Post

Nykc
RE: How To Populate Web Form Select List From .LST File?
2 Mar, 2008 - 02:49 PM
Post #3

sudo rm -R /
Group Icon

Joined: 14 Sep, 2007
Posts: 4,146



Thanked: 16 times
Dream Kudos: 275
My Contributions
Hello & Welcome to Dream In Code.
User is offlineProfile CardPM
+Quote Post

no2pencil
RE: How To Populate Web Form Select List From .LST File?
2 Mar, 2008 - 06:20 PM
Post #4

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,465



Thanked: 66 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
Duplicate post : http://www.dreamincode.net/forums/showtopic44911.htm

** Topic Closed! **
User is online!Profile CardPM
+Quote Post

Closed TopicStart new topic
Time is now: 12/2/08 08:01PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month