HELP!! Perl script to display drop down menu
Perl script to display drop down menu on webpage after reading menu items from a mysql table.
I have a mysql table with a field called Course_name - has like 30 course names in it. Now i need help as i am very green in perl, with a very simple script to access read the table then fetch the course names which will then need to e dispalyed dynamically in a webpage as Drop Down menu / combo box . All the30 course menu items should be displayed in the page after which someone can select any option and have the info about the particular choice they select being displayed. Thanks for helping, will really appreciate. |
Is this what you are looking for?
Code:
my $sth = $dbh->prepare("SELECT course_name FROM table"); |
Some good things to look up are 1) how to connect to a mysql table in Perl (use the DBI module, makes things very easy, as david_ross showed), and 2) how to dynamically write HTML content. Basically, what you'll need to do is make your web page a perl script (instead of a .html file), which does a whole lot of "print" statements. You can't embed perl snippets in a web page the same way you can with php.
I've a simple little Hello, World! perl script on my website: http://www.cybermenology.com/cgi-bin/stuff.pl The code is this, and should give you a good starting point for writing your page: Code:
#!/usr/bin/perl Edit: a good tutorial starts here. |
Many thanks guys ...this is exactly what i needed.
I will surely start coding in perl right away. :) |
All times are GMT -5. The time now is 02:00 AM. |