Monks,

Using CGI I have the following code

#! /usr/bin/perl use CGI; use strict; my $q = new CGI; print $q->header; print $q->start_html(-title=>'macCopy'); print $q->start_form(-enctype=>&CGI::URL_ENCODED, -action=>"myAction.p +l"); print $q->submit(-name=>'submit', -value=>'GoForIt'); print $q->hidden('hidKey','hidVal'); print $q->endform; print $q->end_html;

and it creates the following

<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>macCopy</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form method="post" action="myAction.pl" enctype="multipart/form-data" enctype="application/x-www-form-urlencoded">
<input type="submit" tabindex="1" name="submit" value="GoForIt" /><input type="hidden" name="hidKey" value="hidVal"  />
</form> </body> </html>

Please note the "enctype" in the FORM tag

I am looking for enctype ="application/x-www-form-urlencoded"

When I omit the -enctype=>&CGI::URL_ENCODED option in start_form to try to get the default value (which should be application/x-www-form-urlencoded)it still defaults to enctype="multipart/form-data"

Can anyone put me right and explain why this is happening ?

Thanks in advance


In reply to enctype problem in CGI by macPerl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.