Form passing values

I'm stumped.. I just can't get any value to pass from a form to the next page in the following code

[code]


 

[/code]
fileupload2.cgi
[code]
$quote = $form{'quotenum'};
[/code]

When I output $quote there is no value.. any ideas on why the post to fileupload2.cgi is not working?

Thanks,
David

Comments

  • : I'm stumped.. I just can't get any value to pass from a form to the next page in the following code
    :
    : [code]
    :
    :
    :  
    :
    : [/code]
    : fileupload2.cgi
    : [code]
    : $quote = $form{'quotenum'};
    : [/code]
    :
    : When I output $quote there is no value.. any ideas on why the post to fileupload2.cgi is not working?
    :
    : Thanks,
    : David
    :
    I think I have found out why its not working.. in all the other pages that pass values there is a function that parses the form data. In the fileupload2.cgi that function is not there. But it does parse the input that is passed to it although its not parsing it like the other function.

    This is what is used on other pages to parse the passed form information
    [code]
    %form = &get_form_data;

    sub get_form_data {
    $buffer = "";
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    $buffer .= "&$ENV{'QUERY_STRING'}";
    @pairs=split(/&;/,$buffer);
    $prev_name = '';
    $prev_value = '';
    foreach $pair (@pairs)
    {
    @a = split(/=/,$pair);
    $name=$a[0];
    $name =~ s/+/ /g;
    $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $name =~ s/~!/ ~!/g;
    $name =~ s/[

    ]/ /sg; #remove

    $value=$a[1];
    $value =~ s/+/ /g;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/~!/ ~!/g;
    $value =~ s/[

    ]/ /sg; #remove

    if ($name eq $prev_name)
    {
    $prev_value .= ",$value";
    push (@data,$prev_name);
    push (@data,$prev_value);
    }
    else
    {
    $prev_value = $value;
    push (@data,$name);
    push (@data, $value);
    }
    $prev_name = $name;
    }
    return @data;
    }
    [/code]
    This is the code that is currenly being used to parse the information on the page thats not working for me.
    [code]
    $| = 1;

    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    $buffer =~ /^(.+)
    /;
    $bound = $1;
    @parts = split(/$bound/,$buffer);
    #foreach (0..$#parts) { print "$_ - $parts[$_]

    "; }
    $filename=$parts[1];
    $parts[1] =~ s/
    Content-Disposition.+
    //g;
    $parts[1] =~ s/Content-Type.+
    //g;
    $parts[1] =~ s/^
    //;

    @subparts = split(/
    /,$parts[2]);
    $groupname = '';
    foreach $s (@subparts) {
    $groupname = $s;
    }
    [/code]

    Its a mess but I hope someone can help this it =) All I need to do is get that quotenum value working.
  • And after further research I have found the answer to my problem.
    Parsed out the value I needed.
    [code]
    @subparts = split(/
    /,$parts[3]);
    $quotenum = $subparts[$#subparts];
    $quotenum =~ s/
    //g;
    $quotenum =~ s/
    //g;
    [/code]

    : : I'm stumped.. I just can't get any value to pass from a form to the next page in the following code
    : :
    : : [code]
    : :
    : :
    : :  
    : :
    : : [/code]
    : : fileupload2.cgi
    : : [code]
    : : $quote = $form{'quotenum'};
    : : [/code]
    : :
    : : When I output $quote there is no value.. any ideas on why the post to fileupload2.cgi is not working?
    : :
    : : Thanks,
    : : David
    : :
    : I think I have found out why its not working.. in all the other pages that pass values there is a function that parses the form data. In the fileupload2.cgi that function is not there. But it does parse the input that is passed to it although its not parsing it like the other function.
    :
    : This is what is used on other pages to parse the passed form information
    : [code]
    : %form = &get_form_data;
    :
    : sub get_form_data {
    : $buffer = "";
    : read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    : $buffer .= "&$ENV{'QUERY_STRING'}";
    : @pairs=split(/&;/,$buffer);
    : $prev_name = '';
    : $prev_value = '';
    : foreach $pair (@pairs)
    : {
    : @a = split(/=/,$pair);
    : $name=$a[0];
    : $name =~ s/+/ /g;
    : $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    : $name =~ s/~!/ ~!/g;
    : $name =~ s/[

    ]/ /sg; #remove

    : $value=$a[1];
    : $value =~ s/+/ /g;
    : $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    : $value =~ s/~!/ ~!/g;
    : $value =~ s/[

    ]/ /sg; #remove

    : if ($name eq $prev_name)
    : {
    : $prev_value .= ",$value";
    : push (@data,$prev_name);
    : push (@data,$prev_value);
    : }
    : else
    : {
    : $prev_value = $value;
    : push (@data,$name);
    : push (@data, $value);
    : }
    : $prev_name = $name;
    : }
    : return @data;
    : }
    : [/code]
    : This is the code that is currenly being used to parse the information on the page thats not working for me.
    : [code]
    : $| = 1;
    :
    : read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    : $buffer =~ /^(.+)
    /;
    : $bound = $1;
    : @parts = split(/$bound/,$buffer);
    : #foreach (0..$#parts) { print "$_ - $parts[$_]
    "; }
    : $filename=$parts[1];
    : $parts[1] =~ s/
    Content-Disposition.+
    //g;
    : $parts[1] =~ s/Content-Type.+
    //g;
    : $parts[1] =~ s/^
    //;
    :
    : @subparts = split(/
    /,$parts[2]);
    : $groupname = '';
    : foreach $s (@subparts) {
    : $groupname = $s;
    : }
    : [/code]
    :
    : Its a mess but I hope someone can help this it =) All I need to do is get that quotenum value working.
    :

  • [code]: : $| = 1;
    : :
    : : read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    : : $buffer =~ /^(.+)
    /;
    : : $bound = $1;
    : : @parts = split(/$bound/,$buffer);
    : : #foreach (0..$#parts) { print "$_ - $parts[$_]
    "; }
    : : $filename=$parts[1];
    : : $parts[1] =~ s/
    Content-Disposition.+
    //g;
    : : $parts[1] =~ s/Content-Type.+
    //g;
    : : $parts[1] =~ s/^
    //;
    : :
    : : @subparts = split(/
    /,$parts[2]);
    : : $groupname = '';
    : : foreach $s (@subparts) {
    : : $groupname = $s;
    : : }
    : : [/code]
    : :
    : : Its a mess but I hope someone can help this it =) All I need to do
    : : is get that quotenum value working.

    You're telling me it's a mess...bad news on your solution is that it'll most likely break if you change the order of the fields or add any new ones to the form. Suggest you re-write the above to put the data into a formdata hash - it's not too hard to do if you look at the input you get (I wrote my own custom routine for this a while back and it works great).

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories