Is this inefficient?
| From: | Todd Cary | Date: | Sun, 14 Sep 2003 16:33:55 +0000 |
| Subject: | Is this inefficient? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-162566@lists.php.net to get a copy of this message | ||
I may have two buttons on the form and the Form Action has the same value as the current form, then at the top of my php script, I may have
$continue = $HTTP_POST_VARS[btnContinue];
$cancel = $HTTP_POST_VARS[btnCancel];
followed by
if ($continue) {
//Do something - usually go to another page
} elseif {
($cancel) {
// Do something - usually go to another page
} else {
//Do something
}
Is this inefficient or is there a better way to do this?
+++
For listing records, I create a function, grid_show() and use it like below after creating the header. It gets called for each record in the record set. Suggestions welcomed....
Todd
/* Display the grid */
function grid_show($id, $ct, $date, $place, $est_amt, $card, $ccn, $session_id) {
if ($ct % 2) {
$class = "Even";} else {
$class = "Odd";} echo("<tr>"); // The first column contains a link for the display of the record // in trans_edit.php. echo('<td class="' . $class . '"><b><a href="trans_edit.php?session_id=' . $session_id .
'&tmp_id=' . $id .
'">' . Edit . '</a>' .
"</b></td>");
echo(NL);
echo('<td class="' . $class . '"><b>' . $date . "</b></td>");
echo(NL);
echo('<td class="' . $class . '"><b>' . $place . "</b></td>");
echo(NL);
echo('<td class="' . $class . '"><b>' . $est_amt . "</b></td>");
echo(NL);
echo('<td class="' . $class . '"><b>' . $card . "</b></td>");
echo(NL);
echo('<td class="' . $class . '"><b>' . $ccn . "</b></td>");
echo(NL);
echo('<td class="' . $class . '"><b>' . $state . "</b></td>");
echo(NL);
echo("</tr>\n");
}
--