HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
i'm using frontpage forms
Goto page Previous  1, 2
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
Corey Bryant



Joined: 15 May 2004
Posts: 8154
Location: Castle Rock CO USA

PostPosted: Tue May 18, 2004 4:15 am     Reply with quote

Well we are talking about two different things. Do you want FP to handle the form or a CGI script? It is one or the other.

Since you speak about the CGI, go to http://www.tripod.lycos.com/ - you will see a menu at the top. Choose Tools - Script Library. There you will see CGI Form Handling & hot to use tripod's CGI script.
benj



Joined: 11 May 2004
Posts: 10

PostPosted: Tue May 18, 2004 4:35 am     Reply with quote

what's "FP"?
Corey Bryant



Joined: 15 May 2004
Posts: 8154
Location: Castle Rock CO USA

PostPosted: Tue May 18, 2004 4:42 am     Reply with quote

FP = FrontPage
benj



Joined: 11 May 2004
Posts: 10

PostPosted: Tue May 18, 2004 4:47 am     Reply with quote

ok sorry 'bout that. Smile
benj



Joined: 11 May 2004
Posts: 10

PostPosted: Tue May 18, 2004 4:55 am     Reply with quote

i guess i would want CGI to handle my form. cause in FP if i wil preview the site it says that it has to be publish to server that support FP extensions which is something that i do not understand.
Corey Bryant



Joined: 15 May 2004
Posts: 8154
Location: Castle Rock CO USA

PostPosted: Tue May 18, 2004 5:02 am     Reply with quote

When you say you preview the site - are you previewing it on your local computer? if so, just ignore that warning. Check out http://www.frontpageforms.com
mjpliv



Joined: 11 May 2004
Posts: 406
Location: Nova Scotia

PostPosted: Tue May 18, 2004 8:12 am     Reply with quote

I had a quick look through tripod's website and it seems that the sample forms they offer have to be pointed (thats the "ACTION =" part of the form tag) at pre-installed cgi scripts on their servers. They are quite specific about the address to use.

If you indeed have a mycgi-bin folder with permission to upload and run scripts there then give it a try. Remember that .cgi and .pl scripts have to be uploaded in ASCII mode instead of binary mode. Most scripts will require the permission flags set for 755. You will also need the FULL path to the server perl programs (assuming it is a perl script) in the shebang line (yes - that's a real word) of your script. If you have access to these features, this information should be documented somewhere on your account "control panel".

If this is all Greek to you please don't get discouraged. I would suggest you pick up a book on the subject of perl scripting language. It is probably the easiest of the languages to learn and a natural stepping stone to learning PHP scripting and database servers like MySQL which are the basis for this very forum (follow the phpBB links at the bottom of the page).

If you intend to follow this route I would suggest that you download perl and Apache server (its all free) then install them on your computer. This allows you to experiment as you learn and run the scripts on your own host (localhost). If this sounds complicated - don't worry. Go to http://www.indigostar.com/indigoperl.htm
and download the package that matches your operating system. The Apache server is pre-compiled to run both perl and PHP and includes both programs complete with links to all of the manuals and other support documents for all three bits of software (not bad for free).

Later, if you like, you can download MySQL database server and play around with that too.

Pretty soon you will be answering questions for people on the forum Very Happy
benj



Joined: 11 May 2004
Posts: 10

PostPosted: Thu May 20, 2004 3:43 am     Reply with quote

wow ! mj i cannot understand almost understand everrything you posted. but i know i need a cgi script right? this site (htmlcodetutorial.com) offer a free script, here is it.

#!/usr/bin/perl -w

#=========================================================================
# Copyright 1999-2001 Idocs Guide to HTML, http://www.idocs.com/
# You may distribute this program freely, but keep
# this notice in place.
#=========================================================================

#=========================================================================
# modules
#
use strict;
use CGI;
use CGI::Carp 'fatalsToBrowser', 'croak';

# use lib 'pt/PtLib';
# use lib 'ads/';
# use Banner;
#
# modules
#=========================================================================

#=========================================================================
# variables
#
my (
$query, # CGI query object
$maxFields, # maximum number of fields to accept
$rand, # random number for banners
$inputdata, # filehandle for uploaded files
@inputVals, # values for a field (they can send more than one)
$inputVal, # a single values for a field
$modval, # modified value of
$fileinfo, # uploaded file information
@params, # array of all fields sent
$key,$val, # key an value for $fileinfo hash
$ad,$adcode,
);
$query=CGI->new; # get CGI object
$maxFields=100; # maximum number of fields to accept
$rand = int(rand(100000)); # random number for ad banner

#
# variables
#=========================================================================

#=========================================================================
# top of page
#
print $query->header;
print <<"(TOPOFPAGE)";
<HTML>
<HEAD>
<TITLE>Idocs Guide to HTML: My CGI</TITLE>
</HEAD>
<BODY>

<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
<TR VALIGN=TOP>
<TD><A HREF="/" TARGET="_top"><IMG
SRC="../graphics/logo.med.guide.gif"
WIDTH=157 HEIGHT=75 ALT="Idocs Guide to HTML" BORDER=0></A></TD>
<TD ALIGN=RIGHT></TD>
</TR></TABLE>

<H1>My CGI</H1>

This CGI displays the <CODE>name=value</CODE> pairs sent to it. Feel
free to use this CGI for practice making HTML forms. This CGI is provided
compliments of the <A HREF="http://www.htmlcodetutorial.com/">HTML Code Tutorial</A>.<P>


<!-- You may also be interested in these pages:

<A HREF="http://www.idocs.com/services/checkhtml/check.pl">Check the HTML in Your Web Page</A>, -->

<!--A HREF="requestheaders.pl">Headers Sent By Your Browser</A> and
<A HREF="pageheaders.pl">Headers Sent With Your Web Page</A>.
, and
<A HREF="server.pl">your server software</A>.
-->

(TOPOFPAGE)
#
# top of page
#=========================================================================

#=========================================================================
# list
#

# get list of fields
@params = $query->param;
if (@params > $maxFields)
{croak "No more than $maxFields fields please"}

# open table if necessary
print "<HR><P><TABLE BORDER CELLPADDING=4>\n" if @params;

PARAMLOOP:
foreach my $paramKey (@params) {
print '<TR VALIGN=TOP>';

#----------------------------------------------------------------
# value
#
$inputdata = $query->param($paramKey);

# print STDERR "[b]\n"; # TESTING
# the problem with "Use of uninitialized value in hash element at (eval 6) line 3."
# happens during the next line

$fileinfo = $query->uploadInfo($inputdata);

# if it's an uploaded file
if (defined $fileinfo) {
print
"<TH>", tablesc($paramKey), "</TH>",
"<TD><TABLE BORDER BGCOLOR=\"#FFFFCC\" CELLPADDING=4>\n";

while (($key,$val) = each %{$fileinfo}) {
# content-disposition gives several pieces of
# information about the file, so let's parse it up
if (lc($key) eq 'content-disposition') {
foreach my $dis (split(m|\s*;\s*|,$val)) {
my @dispieces=split(m/\s*=\s*/,$dis,2);
next unless defined $dispieces[1];
next if $dispieces[0] =~ m|^name$|i;
print
'<TR><TD>',
tablesc($dispieces[0]),
'</TD><TD><CODE>',
tablesc($dispieces[1]),
"</CODE></TD></TR>\n";
}
}

# else just print the field
else {
print
'<TR><TD>',
tablesc($key),
'</TD><TD><CODE>',
tablesc($val),
"</CODE></TD></TR>\n";
}
}

# output the file size
seek($inputdata,0,2); # go to end of file handle
print
'<TR><TD>size</TD><TD>',
tell($inputdata),
"</TD></TR>\n";
print '</TD></TABLE>'; #
}

# else it's not an uploaded file
else {
# get array of input values
@inputVals=$query->param($paramKey);
@inputVals=grep(tablesc($_),@inputVals);

# name of field
print '<TH ROWSPAN=',
scalar(@inputVals), '>',
tablesc($paramKey), '</TH><TD><PRE>';

#out put value(s) for field
foreach $inputVal (@inputVals)
{$inputVal = tablesc($inputVal)}
print
join("</PRE></TD></TR>\n<TR><TD><PRE>", @inputVals),
'</PRE></TD>';
}
#
# value
#----------------------------------------------------------------

print "</TR>\n";
}

# close table if necessary
print "</TABLE><P>\n" if @params;

#
# list
#=========================================================================

#=======================================================================
# bottom of document
#

# ************************************************************************
# *** IF YOU COPY My CGI, ABSOLUTELY PLEASE DO NOT CHANGE THIS SECTION ***
# ************************************************************************

print <<"(END BOTTOM OF PAGE)";
<HR><P>
A lot of people have asked to see the code for this CGI.
OK, <A HREF="http://www.htmlcodetutorial.com/acustom/index_famsupp_91.html">here
it is</A>.

<P>

My CGI by <A HREF="http://www.idocs.com/tags/">The Idocs
Guide to HTML</A>, <CITE>copyright 1997-1999, Idocs Inc.</CITE><BR>
This entire web site is served by our friends at
<A HREF="http://www.ninthwonder.com/">Ninth Wonder</A>
</BODY>
</HTML>
(END BOTTOM OF PAGE)
#
# bottom of document
#=======================================================================

#=======================================================================
# tablesc
# return undefined or for space-only/empty string,
# otherwise change < > and & to character entities
#
sub tablesc
{
return " " if (! defined $_[0]) || ($_[0] !~ m|\S|);
$_[0] =~ s|&|&|gso;
$_[0] =~ s|<|<|gso;
$_[0] =~ s|>|>|gso;
$_[0];
}
#
# tablesc
#=======================================================================
They call this as a public file? what does it mean? And if i can use it to tripod, where do i paste this code? what would be the filename? i got this from this site.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial