The numerous declarations of the $LastName variable have already been mentioned to you. After resolving the issue that you are overwriting that variable in your while $sth->fetch_array() routine, I look to where the $LastName variable is reposted to the page within a form so that the next call to your cgi script will have a param with the name LastName but I cannot see one.

The problem is that you do not repost a form from which your cgi script can collect the LastName param. If the search form is written from

print header(), start_html; my $page = "E:/companyname/website/htdocs/resources/header_1.htm"; open (PAGE, "$page") || die "Couldn't open $page"; while (<PAGE>) {print;}

then the search will submit an empty paramater. Outside of this there is nowhere that the page you write has a form which includes a $LastName param

I would not suggest adding the param to the links as the search should be properly submitted via POST through a form.

You should also validate your incoming paramaters using the untainting idiom

my $LastName=param('LastName'); # pattern should match sql field requirement if($LastName =~ /^([\w\s]+)$/){ $LastName = $1; }else{ print invalid search request .html } my $reqpage= param('reqpage'); if($reqpage =~ /^(\d+)$/){ $reqpage = $1; }else{ print invalid page request .html }

relying on sticky param here will not (afaik) work as you are not creating a cgi object, only using the class methods. Also with concurrent search requests a sticky param may get confused.

Supply a form where the $LastName paramater is given, for your script to be delivered the param it is expecting.


In reply to Re: Undefined Value Error Message by Don Coyote
in thread Undefined Value Error Message by Milti

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.