Click here to get back home

receipt of form values by an HTML page

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
receipt of form values by an HTML page cartercc 10-10-2007
Get Chitika Premium
Posted by Scott Bryce on October 12, 2007, 12:09 pm
Please log in for more thread options
cartercc@gmail.com wrote:

> I tend to stuff common code
> in a library module and use a lot of heredocs. That way, HTML is HTML,
> code is code, and (almost) everything is DRY. Personally, I do not
> like to mix code and HTML

But that is my point. By stuffing the HTML into heredocs, you are mixing
HTML and code.

The HTML::Template module will allow you to put the HTML in a separate
file. Your code will only have to "fill in the blanks" by supplying the
values to be inserted into the template.

Trust me. It is a much better way to do CGI. At least read the docs.
Then you can do whatever you want.

Posted by cartercc on October 12, 2007, 2:05 pm
Please log in for more thread options
> carte...@gmail.com wrote:
> > I tend to stuff common code
> > in a library module and use a lot of heredocs. That way, HTML is HTML,
> > code is code, and (almost) everything is DRY. Personally, I do not
> > like to mix code and HTML
>
> But that is my point. By stuffing the HTML into heredocs, you are mixing
> HTML and code.
>
> The HTML::Template module will allow you to put the HTML in a separate
> file. Your code will only have to "fill in the blanks" by supplying the
> values to be inserted into the template.
>
> Trust me. It is a much better way to do CGI. At least read the docs.
> Then you can do whatever you want.

Okay, I'll look at it, but I don't agree that using heredocs mixes
HTML and code, but does just the opposite.

I think that the ideal is to completely separate your user interface,
the programming logic, and your data. The user interface consists of
your presentation information (CSS) and your document markup (HTML).
There are two ways to do this. You can mix your programming logic in
with your HTML, like JSP or PHP. Or, you can mix your HTML in with
your programing logic, like the traditional CGI. I have a strong
distaste for the first method born of experience.

I like to code HTML snippets and put them in a Perl module. That way,
I can make the programming logic do what I want and not worry about
the HTML. For example, suppose I had a PM file with five methods,
header(), form(), error(), insert(), and footer(). Each method accepts
appropriate arguments, for example, the header() method accepts
paramenters for $page_title, $css_link, and $h1_header, so I can make
a call like this, lib::header("My Home Page","homepage.css","Welcome
to my spot on the WWW").

The point is that, in my programming logic, I can do this:

lib::header();
lib::form() if $new_form;
lib::error() if $error_in_form;
lib::insert() if $no_error_in_form;
lib::footer();

It makes for very short scripts, and most of the HTML is in one place.

CC




Posted by Scott Bryce on October 12, 2007, 3:06 pm
Please log in for more thread options
cartercc@gmail.com wrote:

> Okay, I'll look at it, but I don't agree that using heredocs mixes
> HTML and code, but does just the opposite.

Heredocs are contained within code. HTML::Template puts the HTML in a
separate file.

> I think that the ideal is to completely separate your user interface,
> the programming logic, and your data.

HTML::Template will allow you to completely separate your user interface
from your logic/data.

> The user interface consists of
> your presentation information (CSS) and your document markup (HTML).
> There are two ways to do this. You can mix your programming logic in
> with your HTML, like JSP or PHP. Or, you can mix your HTML in with
> your programing logic, like the traditional CGI. I have a strong
> distaste for the first method born of experience.

I have a distaste for either one. HTML::Template provides a third method.

> I like to code HTML snippets and put them in a Perl module.

How about putting them in an HTML file? Read the docs. It is a different
way to work than you are used to, but I think you will see the advantages.

Similar ThreadsPosted
Form Reload with Tainted Values April 28, 2008, 5:13 pm
User hits back button - has to enter form values from scratch January 31, 2008, 8:39 pm
sending hidden values AND option values at the same time ? September 12, 2006, 12:52 am
html contact form on front page January 19, 2007, 11:52 pm
Help with a Form page February 10, 2005, 7:49 am
Multiple Page Form September 8, 2004, 6:46 am
Re: print form value on the web page etc? January 23, 2008, 5:47 am
Forward to new page after competed form. September 17, 2004, 3:36 am
Validation of ASP.Net page - name attribute of form tag May 25, 2006, 10:14 am
How to keep
from re-submitting on page refresh...
July 31, 2007, 2:49 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap