[nycphp-talk] Can't get no $action
leam
leam at reuel.net
Mon Apr 26 08:51:03 EDT 2004
Sorry for the lousy joke, this one's been beating me up for days.
I'm using the editor.php script from "Beginning PHP4" (Wrox press) and
it uses a call to $PHP_SELF to refresh the page on submit. ($PHP_SELF is
set from $_SERVER[PHP_SELF]) At the end there is a switch statement that
is supposed to save the file if the action "save_file" is set, otherwise
just do the regular edit page.
I could not get their script to work so I'm breaking it down to smaller,
more digestible parts. What I'm currently stuck on is getting the call
to save the form if the submit button is clicked.
From the editor_form function:
echo "<form name=edit_form method=post action=$PHP_SELF >";
echo "<input type=hidden name=action value=save_file >";
echo "<input type=submit value='Save and Exit' name=submit>";
From the switch statement:
switch($action) {
case "save_file":
save_file();
break;
default:
html_header();
editor_form();
html_footer();
}
The save_file function works if it's called by itself, and the $action
just seems to call the default.
Any suggestions? Is this even the right area of code to look at? FWIW
I'm certainly able to make basic html errors, so it may not even be PHP
related.
ciao!
leam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20040426/98c55a2d/attachment.html>
More information about the talk
mailing list