[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] CGI line reader (fwd)



According to Richard Duff:
> I am trying to create a CGI using MacPerl that prompts someone for their

CGIs work differently than how you are thinking they work.
CGIs can only produce static web pages.  Not dynamic.  Java
or JavaScript are examples of dynamic interaction with a
user.

So what does this mean?  It means that you use something
like MacPerl to generate the HTML web pages which are then
used and which then send information back to the next
program.  This continues on in a cycle.  So for example:

$!perl

	print <<END_HTML;
Content-type:	text/html

<html>
<head>
<title>My Title</title>
</head>

<body>
This is a test
</body>
</html>
END_HTML

	exit( 0 );

Would create a simple web page which would have on it "This
is a test".  In your case, you would have an html web page
similar to this:

<html>
<head>
<title>My Title</title>
</head>

<body>
<font size=+6>Password</font>
<form name="form1" method="post" action="./getUser.cgi">
<table>
<tr>
<td><font color=#FFFF00>Username:</font></td>
<td><input type="text" name="userID" size=40></td>
</tr>

<tr>
<td><font color=#FFFF00>Password:</font></td>
<td><input type="password" name="password" size=40></td>
</tr>

<tr>
<td colspan=2 align="center"><input type="submit" name="submit" value="Continue"></td>
</tr>
</table>
</form>
</body>
</html

Then your getUser.cgi program would accept the incoming
information (ie: userID and password) and check it against
your database.  After checking, your program would generate
the appropriate new web page (ie: An error page in case of
an error or the main menu if the person entered everything
correctly).

I hope this helps.  :-)

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch