<?xml version="1.0" encoding="windows-1252"?>
<node id="664422" title="Re: form to cgi to cgi" created="2008-01-25 22:21:29" updated="2008-01-25 17:21:29">
<type id="11">
note</type>
<author id="424604">
gam3</author>
<data>
<field name="doctext">
There are lots of ways to do this, but here is a start
&lt;code&gt;
#!/usr/bin/perl
use strict;

use CGI;

my $cgi = CGI-&gt;new();

print $cgi-&gt;header();

print &lt;&lt;EOP;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;test&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
&lt;h1&gt;Please input data below&lt;/h1&gt;
&lt;form&gt;
Name: &lt;input name="testdata" text="name"/&gt;
&lt;form&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
EOP


use Data::Dumper;

use HTML::Form;
use LWP::UserAgent;

if (my $data = $cgi-&gt;param('testdata')) {
    my $ua = LWP::UserAgent-&gt;new;
    
    print "got: " . $data;
    print "&lt;br/&gt;";
    my $html = "http://localhost/cgi-bin/test";

# http://localhost/y.cgi is where the socond form is submitted.

    my $form = HTML::Form-&gt;parse(&lt;&lt;HTML, 'http://localhost/');
&lt;form action="/y.cgi"&gt;
&lt;intput type="text name="test" /&gt;
&lt;/form&gt;
HTML

    $form-&gt;attr( 'test', $data);

    my $response = $ua-&gt;request($form-&gt;click);

    print Dumper $response;
    print "&lt;br/&gt;";

}

1;

&lt;/code&gt;

I hope there are enough hints here to get you going.
&lt;p/&gt;

You might also just want to get the form from the page then fill it out.

UPDATE: Took chromatics suggestion and now use header().

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-424604"&gt;
-- gam3&lt;br/&gt;
&lt;small&gt;A picture is worth a thousand words, but takes 200K.&lt;/small&gt;
&lt;/div&gt;&lt;/div&gt;
</field>
<field name="root_node">
664414</field>
<field name="parent_node">
664414</field>
</data>
</node>
