Hi Monks,
I am a little lost. My web page works perfectly fine when i use the default submit button, however, when i use an img the page no longer works correctly. It doesnt seem to be posting the form correctly?
code for the form is:
<form action="test.cgi" method="post">
<fieldset>
<p><b>User Name:</b> <input type="text" name="username" size="10" maxl
+ength="20" value="test" /></p>
<p><b>Password:</b> <input type="password" name="password" size="20" m
+axlength="20" /></p>
<div align="center"><input type="image" name="submit" value="Login" sr
+c="blue_login.gif" border=0 /></div>
</form>
The form is posted to the same page and i use the following code:
if ($ENV{'REQUEST_METHOD'} eq "GET"){
$my_data = $ENV{'QUERY_STRING'};
}
else {
$data_length = $ENV{'CONTENT_LENGTH'};
$bytes_read = read(STDIN, $my_data, $data_length);
}
@name_value_array = split(/&/, $my_data);
foreach $name_value_pair (@name_value_array) {
($name, $value) = split(/=/, $name_value_pair);
#
$name =~ tr/+/ /;
$value =~ tr/+/ /;
$name =~ s/%(..)/pack("C",hex($1))/eg;
$value =~ s/%(..)/pack("C",hex($1))/eg;
if($form_data{$name})
{
$form_data{$name} .= "\t$value";
}
else
{
$form_data{$name} = $value;
}
}
Any suggestions would be great!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.