Jump to content

Transfer Control between scripts in php ?


katito
 Share

Recommended Posts

Hi all ! :) I'm new in Php. :) I need load other script x.php . :blink: I'm working in "a.php" and I need transfer control to "b.php" from into my code php.Is posibble do this ? (like Javascript). :) I don't need use "method=post or GET". I know use it.But Now I see than PHP is more powerfull than Asp, JavaScript, VBScript, JScript. And I think So yes is posibble in PHP, but I don't found it yet ... :blink: Somebody help me ... Please ?Example:a.php<?phpprint(' Hi everybody !! ' ); print("Here, I want tranfer control to other script (any) b.php ... ") ;print(' ... From here <php-code>, no from html because there I can with ...');print(' <form name='x' action=b.php method="POST"> I don't need this ... ' ) ;....?>THANKS !Regards !

Link to comment
Share on other sites

If you want execution to move from one script to another one, you can use the include or require statements. Control will drop out of the current file and enter the included file, and if that file completes control will return to the original file.include("file.php");

Link to comment
Share on other sites

Thank you So much to all ! :) But I don't understand well ...Look this.In HTML I can to use JavaScrip, to jump to other webpage :

<html><title></title><head></head><body>... ...<script LANGUAGE="JavaScript"><!-- function x() { window.location.href="http://www.dkatito.com" ; }--></SCRIPT>.... ...</body></html>
In any time I can Jump to other WebPage ... (Html & JavaScript)Now I'm using php and I think may be is possible "replace" JavaScript language and use just php ...Is possible Do this in PHP ? ... (If I don't want to use JavaScript any more ...)Thanks !Regards !
Link to comment
Share on other sites

To do that with PHP, it has to be done before any HTML output occurs.If you want to do it after the original page has loaded, you're better off with javascript. If you still want to do it with PHP, it is done like this:

<?	header('Location: otherfile.php');?>

Just remember that in PHP, that has to be done before any HTML output, including empty space.Also, PHP is not a replacement for Javascript. PHP is executed on the server, so there is no interaction with the user on a single page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...