http://www.perlmonks.org?node_id=669120

Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks,

I've hit a wall with this problem and I'm not sure if it's something I've inadvertently done or if CGI.pm is having a problem with generating the HTML code.

I'm generating a HTML form using a combination of OO CGI and print statements because as far as I can tell CGI.pm doesn't support the fieldset and label tags as of yet unless I use CGI::FormBuilder. As I'm trying to do my error checking right in Perl I'm not sure that using that module is the way to go since it does the error checking in JavaScript and I'm just setting CSS options to denote unfilled required fields.

Given this pared down code snippet:

sub html_form{ print qq( <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="generator" content= "HTML Tidy for Windows (vers 24 May 2007), see www.w3.org" /> <title>Wright Popcorn &amp; Nut Company</title> <meta http-equiv="Content-Type" content= "text/html; charset=us-ascii" /> <script src="checkbox.js" language="javascript" type= "text/javascript"> </script> <link rel="STYLESHEET" href="cart.css" type="text/css" /> </head> <body> <div id="header"> <h1> Order your Pink Popcorn Here!</H1> <H2>I want to order: &nbsp; &nbsp;Quantity &nbsp; <INPUT TYPE="text" NAME="quan" VALUE="1" MAXLENGTH="2" SIZE="2"> <INPUT NAME="size" TYPE="radio" CHECKED VALUE="50">50/cs <INPUT NAME="size" TYPE="radio" VALUE="100">100/cs </H2> </div> <div>); print $query->start_form(-name => 'scart'); print qq! <div id="center"> <fieldset> <legend>Billing Informtion</legend>!; print qq! <p><label for="billname" class=$id_check{BillName2}>Name</labe +l> <input id="billname2" name="billname2" type="text" value=$params{billname2} ></p> <p><label for="billaddress1" class=$id_check{billaddress14}>Ad +dress</label> <input id= "billaddress14" name="billaddress14" type="text" /></p> <p class="submit"><input value="Place my Order!" type="submit" + /></p> </fieldset> </div>!; print $query->end_form; print qq( </div> </body> </html> ); }

when I put in just the first paramter, it returns the HTML as I would expect, but only the first part of a possible multi part paramter. For example, if I put blah blah in the name field, after the submit just the first blah is returned in the field. However Data::Dumper shows that blah blah is passed as a parameter.

Anybody have a clue why it seems to be clipping the data there?

Update: As <a href="http://www.perlmonks.org/?node_id=522408>olus pointed out I didn't have the double quotes around the value, but it turns out that I didn't need the value there anyway. Apparently the input id and name pieces takes care of that. If I'm incorrect in that reasoning, please let me know.


Revolution. Today, 3 O'Clock. Meet behind the monkey bars.

I would love to change the world, but they won't give me the source code