Hello,

I am trying to expand a scalar variable in my cgi script and can not seem to get it to work correctly. Any help would be appreciated. I have written a simple script below to demonstrate my problem:

#!/usr/bin/perl use HTML::Template; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); $|=1; print "Content-type: text/html\n\n"; print '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">'."\n"; print "<html>\n"; print "<head>\n"; print "<title>TESTING</title>\n"; print "</head>\n"; print "<body>\n"; $download = "download"; $link = "http://129.107.52.101/cgi_data/result2007623204259.pdf"; print '<input type="button" value="Download PDF Report" onClick=$link, + $download); return false;">'; print "</body>\n"; print "</html>\n";

When I clicked on the download button to download the pdf file, it did not pop up a download window as I expected it to. I used the browser view source option and found out that $link and $download did not get expanded. Any thought on this?

Code tags added by GrandFather


In reply to Expanding Scalar Variable 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.