Radio Button go to another file on Submit

Here’s some high level code that might help.

#!/usr/bin/perl

use strict;
use warnings;

# Use functions from CGI.pm to make your life easier
use CGI qw[header redirect param];

# Hash containing valid redirection values.
my %valid_redirects = map { $_ => 1 } qw[process calendar location
                                       users find];

# Get the chosen option
my $option = param('option');

# If we've a) got an option and b) it's a valid option
# then redirect to the chosen page.
if ($option and $valid_redirects{$option}) {
  # You'll need to write a redirect_to() subroutine
  print redirect_to("$option.html");
} else {
  # If we don't have a valid redirection option, display the form.
  # You'll need to write an html_form() subroutine
  print header;
  print html_form();
}

Leave a Comment