Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Passing Variable

Quote Reply
Passing Variable
Hello. Relatively new at this -- new to cgi, html -- the whole shebang -- but everything is working out. I do need help with one thing tho...

In my add form, (add.html), I've added a drop down field select for any of 65 country names. I need to load the database not only with the country name but also with a number that corresponds to that country (001 to 200).

My definitions for the two fields (in links.def):

Country => [10, 'numer', 5, 8, 0, '167', ''],
Countryname => [11, 'alpha', 60, 60, 1, '', ''],

The add form is working as it should. But need the best way to get the corresponding number variable into the database at the same time as the country name.

(The number corresponds to .gif images for the country that will appear on the links pages, e.g., 167.gif for the US.)(I'm using templates.)

Any help with this would be appreaciated.

Thanks,

jdean


Quote Reply
Re: Passing Variable In reply to
In Reply To:
But need the best way to get the corresponding number variable into the database at the same time as the country name.
Create another database called countries.db and then copy the appropriate codes used for using the categories.db. You will also need to create another file called countries.def and countryid.txt.

It would be problematic with the flat file version to put ID numbers of COUNTRIES into the Country field within the links.db file. Basically, what you would have to do is change the drop-down to contain ID values from the countries.db file rather than the country name.

Then to print the corresponding image file, you will need to port the Relational Mod for DBMAN that will allow you to read data across multiple databases. Then you will have to add conditional statements (if, elsif, else) in the sub site_html_link routine that will check the COUNTRY field value against the number of .gif files contained within your server. You will have to create a TAG (<%%>) out of a common variable used in the conditional statements. Then you can simply put this tag in the link.html file.

I know this may all seem complex...but I no longer write complex modifications for Links 2.0, so I can't provide you codes to copy and paste...but the above logic should get you started.

Regards,

Eliot Lee
Quote Reply
Re: Passing Variable In reply to
Thank you for replying so quickly!

Decided to enter the country code from a list I'll have on hand at the time I validate... at least until I can learn more.

Am using this in link.html and it's working out:

<%if Country%>
<img src="../images/<%Country%>.gif" WIDTH="31" HEIGHT="16" BORDER="0">
<%endif%>

"Links" is quite a program! and the site's gonna be great because of it! Thanks.

jdean