use CGI (:standard);
$ref = "x.cgi";
a({href=>$ref}, "yy")
textfield({name=>"yy", size=>5})
password({name=>"yy", size=>5})
textarea({name=>"yy",
cols=>5, rows=>2})
submit({value=>"yy"})
button( {name=>"xx",
value=>"yy",
onclick=>"submit()",
}
)
%labels = (0=>'a',1=>'q',2=>'x');
popup_menu( { name=>"xx",
values=>[0..2],
labels=>%labels,
size=>4,
}
)
@a = ('xx','yy','zz');
radio_group( { name=>'nn',
values=> @a,
default=>'_',
linebreak=>1,
}
)
%labels = ('xx'=>'L1','yy'=>'L2');
@a = keys( %labels );
checkbox_group( { name=>'nn',
values=> @a,
labels=> %labels,
}
)
table(
Tr(
[
td(['a','b']),
td(['x','y']),
]
)
)
|
# The Perl/CGI functions have the
# additional property of "stability"
# when used in reentrant forms.
# The values of the HTML elements are
# set according to the incoming
# parameter values for those elements.
# The versions below are not stable.
$ref = "x.php";
<a href="<?php echo $ref?>">yy</a>
<input type=text name=yy size=5>
<input type=password name=yy size=5>
<textarea name=yy cols=5 rows=2>
</textarea>
<input type="submit" value=yy>
<input type="button"
name="xx" value="yy"
onclick="submit()">
<select name="xx" size="4">
<?php
$labels = array(0=>'a',1=>'q',2=>'x');
foreach (range(0,2) as $_)
echo "<option value='$_'>",
$labels[$_];
?>
</select>
$a = array('xx','yy','zz');
foreach ($a as $_)
echo "<input type=radio
name=nn value='$_'>$_<br>";
$labels = array('xx'=>'L1','yy'=>'L2');
foreach (array_keys($labels) as $_)
echo "<input type=checkbox
name=nn value='$_'>",
$labels[$_];
<table>
<tr>
<td>a</td><td>b</td>
</tr>
<tr>
<td>x</td><td>y</td>
</tr>
</table>
|