473,700 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I am newbie to perl

2 New Member
i should dispay a retrieved value from mysql database in a text field on clicking a button in perl..please any one help me
Aug 14 '12 #1
4 1625
numberwhun
3,509 Recognized Expert Moderator Specialist
Why don't you try writing this and see how far you get before you get stuck. It involves DBI elements, as well as elements of CGI programming, but its not aweful if you can read the documentation.

If you get stuck or have errors you cannot troubleshoot, simply paste your code into this thread and we will try to help and guide you.

Regards,

Jeff
Aug 14 '12 #2
karthik1chintu
2 New Member
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. package C4::test123;
  3. use DBI;
  4. use strict;
  5. use CGI;
  6. require Exporter;
  7. my $q=new CGI;
  8. my $somevalue=$q->param('fieldname');
  9. #get the input from the formfield.
  10.  
  11. print $q->header;
  12.  
  13.       print "Content-type: text/html\n\n";
  14.        print "<html><h1>Hello!</h1></html>\n";
  15.  
  16. # Connect to the database
  17. # See footnote 1
  18. my $dbh = DBI->connect('DBI:mysql:sample228', 'koha', 'koha')
  19.     or die "Couldn't open database: $DBI::errstr; stopped";
  20.      # Prepare the SQL query for execution
  21. my $sth = $dbh->prepare(<<End_SQL) or die "Couldn't prepare statement: $DBI::errstr; stopped";
  22. SELECT author, title, notes FROM biblio WHERE author = 'james'
  23. End_SQL
  24.  
  25. # Execute the query
  26.  $sth->execute() or die "Couldn't execute statement: $DBI::errstr; stopped";
  27.  
  28.  
  29.  
  30. while(my @row = $sth->fetchrow_array) {
  31.  
  32. print STDOUT "Field 1:$row[0]  Field 2: $row[1]  Field 3: $row[2]\n";
  33.  
  34. print $q->textfield('field_name','$row[0]',50,80);
  35. my $value = $q->param('foo');
  36.  $q->param('foo',"I'm taking over this value!");
  37.  print $q->submit('button_name','value');
  38.      }
  39. # Disconnect from the database
  40. $dbh->disconnect();
Aug 14 '12 #3
numberwhun
3,509 Recognized Expert Moderator Specialist
Did you receive errors when running your code? Sorry, we cannot read your mind.
Aug 15 '12 #4
StephenHawking9
3 New Member
hi,
to use perl you first have to know what is it? and how it works?
what are the differences? e.t.c and that's why i think you should visit this link: http://www.techyv.com/questions/ques...tween-versions
this will give you ideas of where to use it and how.
Aug 16 '12 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

42
4084
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time. I'm not interested on which language is better in *general*, just for my purpose. My area of research is in CAD algorithms, and I'm sensing the need to resort to something more expedient than C++, bash scripting, or sed scripting.
3
3029
by: lonelyplanet999 | last post by:
Hi, I'm a newbie to perl and is now studying about perl programming, I read some perl programming tutorials online (enter 'Perl tutorial' at google.com) and also find some sample perl scripts for study. For below statements I couldn't understand what is the function of '$in'. I tried to search through the perl script tutorial pages since this morning (now it's afternoon) but still couldn't find the explanation. Could anyone help...
2
4024
by: Kevin Horton | last post by:
I'm a perl newbie, with next to no programming experience (I did a bunch of Fortran 25 years ago, but nothing since). I have a problem I need to solve, and I'm wondering whether perl is the best tool. I need to log a fairly fast data stream to a file, after adding a time stamp to the end of each line. The data is ASCII text, and will be coming into a serial port on a laptop. The data stream is at 115,200 baud, with 64 lines per...
1
20560
by: daniel kaplan | last post by:
i am a newbie PERL programmer, oldtime C guy here....anyway, i am starting some PERL scripts on a shared LINUX server. i cannot store my MySQL login parametrs in the apache config, since it is shared....so i was suggested this: "Typically the best way to handle mysql password protection is to put it in a "config" file, that will not be rendered as text by the web server, such as config.php. This way if someone calls the file directly,...
4
9045
by: Firewalker | last post by:
Hey guys, I am newbie to perl. I am trying to deal with dates ( such trying to find what the date would be after month). Is therea function or date class( I am a java programmer, I couldnt find the right word instead of class) to do the job? Thanks for any help.
6
6022
by: Danny Lu | last post by:
Hi, can anyone tell me where I can get a good perl book? TIA Dan
9
20894
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at rapidshare news : http://images.rapidshare.com/software/rsapi.pl If you test it you will see that you can upload one file at time. I try to modify it in that way that script can read a text file with the names of the files i want to...
4
1545
crystal2005
by: crystal2005 | last post by:
Hello guys.... I'm newbie in Perl Language. So, in here i would like to ask several questions about Perl itself and not about the coding. I have been given a task to use Perl for directory comparison and synchronization. I have to implement Perl scripts that accept two directories as input, compare the files and sub-directories under these two directories, and generate a well formatted report as the output. Since I'm a beginner in Perl,...
8
2429
by: Palindrom | last post by:
Hi everyone ! I'd like to apologize in advance for my bad english, it's not my mother tongue... My girlfriend (who is a newbie in Python, but knows Perl quite well) asked me this morning why the following code snippets didn't give the same result : ### Python ###
10
1403
by: Mladen Gogala | last post by:
I am a Python newbie who decided to see what that Python fuss is all about. Quite frankly, I am a bit perplexed. After having had few months of experience with Perl (started in 1994 with Perl v4, and doing it ever since) , here is what perplexes me: perl -e '@a=(1,2,3); map { $_*=2 } @a; map { print "$_\n"; } @a;' The equivalent in Python looks like this: Python 2.5.1 (r251:54863, Jun 15 2008, 18:24:51)
0
8714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8641
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9203
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9060
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8958
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7797
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2021
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.