Controlling the sequence of events in PHP

OK. I’m reasonably new to PHP but I have a lifetime of experience in programming. I’ll admit most of my experience is in mainframe and COBOL programming but I am conversant with HTML as well as various forms of C.

Here’s my problem: I understand the construct of using the form to invoke a different PHP module to handle the form. When I run through the module and exit, I was expecting it to go back to the module with the form and that I’d then see the page still formatted as it was whtn the submit was clicked. What I’m getting is just a blank screen. The module I wrote is designed to send an e-mail and it does that. So I know it is executing. I tried exit and that didn’t do the trick. What am I missing?

As a matter of interest, is there a language construct that allows you to transfer to a different page WITHOUT an event to trigger it? In other words, if I’m going along in a php script and want to go to another page or BACK to the page from which the transfer was originally initiated by an event (like click or submit), is there such a thing? In COBOL, I would have said “EXIT” or “GOBACK”. Is there such a thing in PHP?

Try a html header line after the mail is sent.

<meta http-equiv="REFRESH" content="0;url=URL HERE"/>

Change the 0 to number of seconds before refresh (0 should be fine), and put your url where it says URL HERE.

[php]
//You can use the below code to move to filename.php file . Note that you should not print anything or pass the header before this line. Otherwise the below line will now work . 8)

header(“Location: filename.php”);

//if you are in index.php , the above code will transfer you to ‘filename.php’.

[/php]

Thank you. That was perfect.

Sponsor our Newsletter | Privacy Policy | Terms of Service