Re: build button with php
| From: | Hugh Bothwell | Date: | Wed, 15 Aug 2001 19:45:29 +0000 |
| Subject: | Re: build button with php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62894@lists.php.net to get a copy of this message | ||
"Nafiseh Saberi" <nsaberi@iraninfocenter.net> wrote in message
news:200108151912.f7FJCDS17109@persia.iraninfocenter.net...
> I want to build buttons with php
> and when click eavh of them ,
> one special work ,do for me.
<html><body>
<?php
function action1() {
echo "<br>Do action 1";
}
function action2() {
echo "<br>Do action 2";
}
function action3() {
echo "<br>Do action 3";
}
$action_list = array(
"Action 1" => "action1",
"Action 2" => "action2",
"Action 3" => "action3"
);
function writeForm() {
global $action_list;
echo "\nChoose an action!";
echo "\n<form action='$PHP_SELF'>";
foreach($action_list as $key => $fn)
echo "\n\t<input type='submit' name='action'
value='$key'><br>";
echo "\n</form>";
}
if (isset($action) and isset($action_list[$action])) {
$t = $actions[$action]();
$t();
}
else
writeForm();
?>
</body></html>