CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Need help in adding data to the database

 



datlaravi
Deleted

Jun 5, 2000, 9:50 AM

Post #1 of 2 (399 views)
Need help in adding data to the database Can't Post

Hi,
I want to add a location to the database through the drop down list. When i add to the list it should appear in the drop down list.
Can you help me if there is an example of this. Please ---


CuzDesign
Deleted

Jun 6, 2000, 2:45 AM

Post #2 of 2 (399 views)
Re: Need help in adding data to the database [In reply to] Can't Post

Hello,
You could do something like this to print the options to the drop down menu, this is of course if the item is in the data.txt fiel and is the first thing in possition, by a database file seperated with ":". If this is assuming from what you said you want to READ from the file after you have already added it and then print it to the drop down box.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


print "<select name=\"data\" size=\"1\">\n";
print "<option selected>-----Please Choose------</option>\n";
open (DATA,"<data.txt") or die "Couldn't open data,txt $!\n";
while (<DATA> ){
chomp;
my @list = split(/:/,$_);
$entry = $list[0];
print "<option>$entry</option>\n";
}
print "</select>\n";
</pre><HR></BLOCKQUOTE>

Hope this helps.

Regards,
Ray

[This message has been edited by CuzDesign (edited 06-06-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives