[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
[mv] Embedded Perl Code
****** message to minivend-users from "Dennis Duval" <skip-minivend@seacove.net> ******
I'm trying to setup up a drop down box that will use Perl to assign the
product categories from a database, but I'm having a hard time getting the
embedded Perl script to output the HTML code that I want. My code looks
something like this and is inserted into the page called 'leftside'.
<select name="mv_searchspec">
[perl]
$cat_db = "/home/minivend/surplus/products/categories";
open (FILE, "$cat_db") || die "Couldn't open category file";
while($line=<FILE>) {
push(@categories,"$line");
}
close(FILE);
for $i(0..$#categories) {
"<option>", $categories[i];
}
[/perl]
</select>
What i would like to see in the resulting source, is something like this:
<select name="mv_searchspec">
<option>Footwear
<option>Hats
<option>Shirts
</select>
but what I end up with is:
<select name="mv_searchspec">
</select>
Is it legal to open a open and read a file in this context within the
leftside page, and if so, how can I get it to output the correct HTML code?
Dennis Duval
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list