Jerry Rocteur wrote:

> Hi,
>
> I'm enjoying writing scripts using DBI, I'm doing it with Sybase and
> MySQL and it is a whole lot of fun.
>
> I'd like to stick some stuff on the web and I've started playing with
> CGI but I hate this, almost as much as I hate creating HTML docs ;-)
>
> Anyway, I decided not to re-invent the wheel and to search the web for
> some sample scripts, especially data entry stuff and I came across
> phpMyAdmin.. But of course I don't want to do PHP I want to do Perl, my
> ISP says, use Perl for all your scripts but if you want to do Web stuff
> just use PHP.. I don't want to do that, I saw a post from Jose and he
> talks about Mason, but my ISP doesn't have Mason.. Anyway, I've just
> tested and my ISP does have CGI and it works..
>
> I was wondering, can anyone point me to some precooked Perl CGI scripts
> that already do data entry, I can browse and search my tables already
> in CGI and DBD but I loathe to make what I've done look reasonable and
> even worse, starting to create forms etc for data edit and data entry
> would make my hair even more grey than it is now..
>
> Of course I don't mind modifying already working scripts and I
> certainly don't need anything too fancy ..
>
> Thanks in advance for any help.
>
> Jerry.
>
> P.S. if someone can ask how to do a search and replace in Perl and
> people answer, I figure I can ask this .... And I'm sure many of you
> have done it, send me your scripts ;-)

Hi Jerry,

Well, I'm not going to point anyone toward precooked scripts, but... I will
gladly show you how easy it can be to get information thyrough the CGI.
Actually, it is highly unlikely that you will find a precooked script to do
the whole job for you.  Effective use of modules though can help take the
esoterica of the interface protocols out of the picture.

If you have already mastered DBI, then this should be a snap.  Every field
in your db tables has a name, right?  That means you're already ahlfway
there.  Each input in an html form also can have a name attribute.  With
fairly small effort, you should be able to grab th value entered into any
form field by its name, and pipe it right into the db field of the same
name.
Here is a quick-and-dirty working example of getting data with CGIYou
should be able to reproduce and run these on your localhost web server:

cgi_test.html:

<html>
<head>
<title> Enter Name </title>
</head>

<body>
<form action="cgi_test.cgi" method="POST">
<p> <b> Name:</b><input type="text" name="name" value=""></p>
</form>
</body>
</html>

cgi_test.cgi

#!perl -w

use strict;
use warnings;

use CGI;

my $cgi = CGI->new;

my $name = $cgi->param('name');

print $cgi->header, "\n",
      $cgi->start_html('Return the Name'), "\n",
      $cgi->h1('Returning Your Name'), "\n";
print $cgi->p($name), "\n";
print $cgi->end_html;


If these don't run, you may need to do some configuration with your web
server.  Once you can run them, you pretty much ave the key for getting
data out of html pages.

Also, don't forget that there is an entire group devoted to supporting you
in your efforts to master CGI, [EMAIL PROTECTED]

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to