Hello! I'm trying to pass parameters from one perl-script to the other. The code is as follows:
#!c:/perl/bin/perl.exe use DBI; $,="\t"; use CGI qw(:all escape); $username=param("username"); $password=param("password"); $condition; $cond; $db=DBI->connect("dbi:mysql:administration") or die"\n Error($DBI::err +):$DBI::errstr\n"; $aquery="select pass from password where username='$username'"; $a=$db->prepare($aquery); $a->execute(); while(@result=$a->fetchrow()) {foreach $result(@result) { if ($result eq $password) {$condition=1; } } } if($condition==0) {print"content-type:text/html\n\n"; print"<html>\n"; print"<body bgcolor=\"#990000\"><font color=\"white\">"; print "Sorry but your password does not match your username. Please tr +y again. <br><form action=\"login.pl\" method=\"post\" target=\"mainF +rame\">Username: <input type=\"text\" name=\"username\" size=\"15\">< +br><br><br> Password: <input type=\"password\" name=\"password\" size=\"15\"><br>< +br><br><center> <input type=\"submit\" value=\"Submit\"></form></center>" ; } else { print redirect(-location=>'http://localhost/cgi-bin/de.pl?username=$us +ername'); }
I want the second file "de.pl" to get this parameter and do something with it. It works fine when I put in the first script username=pat but not when I put username=$username. What am I doing wrong? Thank you

In reply to passing parameters by Anonymous Monk

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.