OK, I have a multi-page form. If on the first page show a "next" button, if on the second page show a "previous" button (and a "next" if there is a third page), etc, and if on the last page only show a "previous" button.
$form->name = "username"; // or whatever page we are on
$parts = array("username","basic_info","shipping_info");
This is as far as I got:
foreach($parts as $part) {
if(!$next_part) { // first iteration
if($part == $form->name) { // we must be on the first page, so:
$previous_submit = false;
break;
}
}
$next_part = true;
if($part == $form->name) { // check on subsequent iterations, and if so:
$previous_submit = "<input type='image' .. src='button_{$previous_part} .. />";
break;
}
$previous_part = $part;
}
But I don't know how to integrate the "next" part into that foreach. I am aiming at as few lines of code as possible to achieve this. Anyone want to take a stab? It takes a little more IQ than i've been blessed with... 🙂