I have one page that does 3 different things depending on $_GET:
1. It shows an index with items.
2. It shows an item with a form to submit an amount.
3. It confirms the amount.
I was just wondering, since I haven't approached anything like this if I'm ding something I shouldn't be doing.
To get the post variable to work, I had to add some get variables to the form action. Would it be better to use hidden
fields?
<?php
if (!isset($_GET['action']) || $_GET['action'] == 'home') {
include_once($index_page);
}
elseif (isset($_GET['action']) && isset($_GET['item_id']) && $_GET['action'] == 'item') {
if (isset($_POST['amount'])) {
confirm($_POST['amount']);
include_once($confirm_page);
}
else {
$form = '<form action="' . $_SERVER['PHP_SELF'] . '?action=item&item_id=' . $item_id . '" method="post">' .
'<input type="text" name="amount">' .
'<input type="submit" value="Enter Amount">' .
'</form>';
echo $form;
include_once($item_page);
}
}
?>
Thanks,
J Moore