input type="text" => action"....

G

Georg Ringer

Hello,

how can I get the value of <input type="text" name="textfield"> of my form
into the action="xxxx"?

Many thanks in advance
Georg
 
D

David Dorward

Georg said:
how can I get the value of <input type="text" name="textfield"> of my form
into the action="xxxx"?

You don't. You submit the form and let the browser attach it to the query
string (or POST data). You then have your form handler respond
appropriately.
 
G

Georg Ringer

You don't. You submit the form and let the browser attach it to the query
string (or POST data). You then have your form handler respond
appropriately.

Hello David,

thanks for your fast answer! Can you give me a example how I can do this?

thanks!
georg
 
D

David Dorward

thanks for your fast answer! Can you give me a example how I can do this?

From memory, untested:

package My::package;
use strict;
use warnings;
use Apache::Constants;

my %dispatch_table = (
foo => \&foo,
bar => \&bar
);

sub handler {
my $r = shift;
my $action = $r->param('action');
if (defined $dispatch_table{$action}) {
$dispatch_table{$action}();
} else {
error();
}
}

sub foo {
# Do stuff
return OK;
}

sub bar {
# Do other stuff
return OK;
}

sub error {
return HTTP_NOT_FOUND;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top