thanks for the code, works perfectly,
now im running into a problem where my POST varibles arnt carrying over from function too function, form too form
i have multiple post forms, as youll see from the example below of some code, you can see that when it goes too cont_form() function it doesnt bring over the varibles of $_POST['textbox'] - and it just leaves it as blank; how can i fix this up so i can enter something into the textbox itll save as a varible so that it may be called up at a later stage
i think it breaks because i have two forms, as ive asked this above, how can i set a post varible too a global varible so that i can then use that global varible in another function after another form post????
for example i have this code, youll see that when you go into cont_form() it doesnt bring over the $_POST['text'] varible, how can i fix?
Code:
<?php
;
if(isset($_POST['task'])) {
process_form();
} elseif (isset($_POST['cont'])) {
cont_form();
} else {
show_form();
}
function show_form () {
?>
<FORM method="post" action="<?php $_SERVER[PHP_SELF]?>">
<INPUT type="text" name="textbox" size="20"><BR>
<input type="submit" name="task" value="continue">
</form>
<?php
}
function process_form () {
echo "<BR>You typed <b>" . $_POST['textbox'] . "</b> in the textbox; press continue too continue or cancel too reset\n";
?>
<FORM method="post" action="">
<input type="submit" name="cont" value="continue">
<input type="submit" name="cancel" value="cancel">
</form>
<?php
}
function cont_form () {
echo "<BR>You typed <b>" . $_POST['textbox'] . "</b>\n";
}
?>
Recent comments
1 day 4 hours ago
1 day 10 hours ago
1 day 10 hours ago
1 day 10 hours ago
1 day 11 hours ago
1 day 13 hours ago
1 day 16 hours ago
1 day 16 hours ago
1 day 16 hours ago
1 day 17 hours ago