use Mojolicious::Lite;
get '/' => sub {
my $self = shift;
$self->render('index');
};
post '/action' => sub{
my $c = shift;
$c->render('response', msg => $c->param('cars'));
};
app->start;
__DATA__
@@ index.html.ep
<!DOCTYPE html>
<html>
<body>
<form method= "POST" action="/action">
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<br><br>
<input type="submit">
</form>
</body>
</html>
@@ response.html.ep
%if($msg == "fiat"){
You entered the correct car <%= $msg %>
%}else{
You did rubbish!! <%= $msg %>
%}