Re: Problems processing a form; please help!

From: Date: Fri, 20 Oct 2000 05:40:13 +0000
Subject: Re: Problems processing a form; please help!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-21351@lists.php.net to get a copy of this message
<form name="polls" action="polls_process.php?" method="get"> When I submit the form (from polls.php) and process the form (with polls_process.php) the active page becomes polls_process.php (just processing, no output, empty browser screen). But I don't want to change the page! I want to stay on polls.php. Do the processing, but stay on polls.php. Is this possible?
Change your action back to just "polls.php". Assuming $submit is the name of your SUBMIT FORM button: At the top of polls.php code, just say: if ($submit) { include "polls_process.php"; } Or, if "polls_process.php" might not like what it sees, try this: if ($submit) { if (include "polls_process.php")
     { $successful = 1; }
} if (!$successful) { print "bad bad bad boy." /* SHOW YOUR FORM AGAIN HERE */ } The point? "include" is now gives a boolean result. (TRUE/FALSE) in your "include" file, if something goes wrong, you can say "RETURN FALSE;" and the "if" command surrounding it will fail.

« previous php.general (#21351) next »