Forums

PHP

This topic is locked

Form Update/Insert redirect

Posted 18 Jan 2002 17:13:12
1
has voted
18 Jan 2002 17:13:12 Geoff Moody posted:
Is it possible instead of selected a page to go to after the form a form is submitted that the same page is diplayed only it says "The Form has Been Submitted" I think this is possible in PHP as a conditional statement as to whether the form has been submitted or not, but I don't know how to do it.

Replies

Replied 19 Jan 2002 02:53:09
19 Jan 2002 02:53:09 Tim Green replied:
Yes. Change the action attribute of your form to:-

<?php echo $PHP_SELF; ?>

and inside your form, put in a hidden field like this:-

< input type="hidden" name="formSubmitted" value="true">

Then at the very top of your page (in code view) put in some code like this:-
<?php
if (isset($HTTP_POST_VARS["formSubmitted"])) {
// process form here
$processComplete = true;
}
?>

Then go to where you want your "Form Submitted" message to be in design view, and type out your message. Select it, then go to Code view and before it enter the following:-

<?php
if ($processComplete) {
?>
Form Submitted
<?php
}
?>

I included the Form Submitted part to indicate that these code blocks go immediately before and immediately after your message text.

That should do it! Hope it helps <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic