![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
|
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. __________________ :::::---DOMQUEM---:::: |
|
|
|
|
|
#2 |
|
Newbie
|
please any help greatly apprecated
|
|
|
|
|
|
#3 |
|
PFO Founder
![]() ![]() |
what do you know how to do in perl that you will need for this project? if you know how to access and get info from the db then it is just a matter of taking the info from the db and putting it into the html menu.
#!/usr/bin/perl -w
# Created by: Kyle Kjorsvik Date 1-26-04
use CGI qw/:standard/;
use CGI::Carp qw/fatalsToBrowser/;
use DBI;
$dbh = DBI->connect("dbi:Pg:dbname=".$dbname." host=127.0.0.1", "username","pass")
or die "Can't connect to database\n";
$sth1 = $dbh->prepare("SELECT * FROM dbtable WHERE something");
$sth1->execute;
if ($sth1->rows){
$i = 0;
while ((@tstnwk) = $sth1->fetchrow_array){
//move move stuff from db to variables you want them in
$i++;
}
}
$sth1->finish;That code should work for connecting to a db but i dont have anything specific in there ![]() your turn to write some code and if you need help please post it oh and it normally takes more then 1 min for you to get help so you dont need to create another post to see if we are reading only 1 min after you created the thread. try and wait say like 4 hours ![]()
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. Last edited by big_k105; Jun 1st, 2005 at 11:01 PM. |
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() ![]() |
going to add your Perl code to my code repository big_k
![]()
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#5 |
|
PFO Founder
![]() ![]() |
cool
is there a link to the code repository on your site?
__________________
BIG K aka Kyle Programming Forums Kyle K Online Please do not PM or email me programming questions. Post them in the forums instead. |
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() ![]() |
Yeah, its under the Code link on the menu... but requires membership on the site... still working on the code base structure and overall layout.... as of right now, its just a listing of whats currently available... still have hundreds of my progs to list on it, plus a few useful ones from others... i want to also have hte ability for members to upload code as well. should have a good structure up to par by this weekend.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#7 |
|
Newbie
|
thx
Thanks BIG_K for the snippet , working on it as of right now.
Sorry for the posting after a minute. ![]() |
|
|
|
|
|
#8 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
I've got about a dozen mini-apps you might wanna add to that repository, IR.
|
|
|
|
|
|
#9 |
|
Programming Guru
![]() ![]() ![]() |
Alright Ooble... When I get the upload portion available I'll IM you... Of course, credit will be given to you for anything you contribute. Thanks man.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|