katito Posted November 20, 2006 Share Posted November 20, 2006 Hi all ! I'm new in Php. I need load other script x.php . 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 ... 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 More sharing options...
Lulzim Posted November 20, 2006 Share Posted November 20, 2006 you can do that using sessions or cookiessearch for session or cookie in php.net Link to comment Share on other sites More sharing options...
justsomeguy Posted November 20, 2006 Share Posted November 20, 2006 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 More sharing options...
katito Posted November 22, 2006 Author Share Posted November 22, 2006 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 More sharing options...
Tarte Posted November 22, 2006 Share Posted November 22, 2006 Could you please explain clearly what you want to do. what you want to transfer from ''A'' to ''B''it'll be alot easier to help you Link to comment Share on other sites More sharing options...
DeathRay2K Posted November 22, 2006 Share Posted November 22, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now