Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Callling web page from php (http://www.go4expert.com/forums/callling-web-page-php-t26091/)

lastmanse 19Jun2011 02:08

Callling web page from php
 
Does anyone know af an easy way to transfer control to an HTML page from within php code?

shabbir 19Jun2011 08:51

Re: Callling web page from php
 
Many type of transfer you can achieve. The easiest is the redirect to an html page.

lastmanse 20Jun2011 01:56

Re: Callling web page from php
 
what is the format of the command to do that? I am brand new to php and can barely spell php...

lastmanse 20Jun2011 02:02

Re: Callling web page from php
 
AHA - header command!

pein87 20Jun2011 04:08

Re: Callling web page from php
 
Technically speaking html doesn't do anything aside from mark up text and media to be presented on the web, css does the presentation and style, javascript does the dynamic content portion and php does the server side backend and data control. You could use ajax to do this and there exist multiple ways to do this which include 3 common methods all of which can be done via php. Theres outputting a meta refresh, javascript and the plan php redirect.

meta tag refresh

HTML Code:

<meta http-equiv="refresh" content="600;url=www.mysite.com" />
javascript redirect

Code: JavaScript

<script type="text/javascript">
function redirect(loc,t,ts = "S")
{
if(ts == "M")
/* minutes add multiply by 1000 for minutes */
{
var pageShift = setTimeout(loc,t * 60000);
}
if(ts == "MS")
{
/* do nothing */
var pageShift = setTimeout(loc,t);
}
if(ts == "H")
{
/* use hours */
var pageShift = setTimeout(loc,t * 3600000);
}
if(ts == "S")
{
/* seconds */
var pageShift = setTimeout(loc,t * 1000);
}
}
</script>


php header

PHP Code:

<?php
function redirect($url)
{
return 
header("location: " $url);
}
redirect("http://www.mysite.com");
?>

the first two can be outputted via a php page using echo or print functions which would redirect to a standard html page, the second one would redirect one page load and function call. Hope this works for you

ManzZup 3Jul2011 20:51

Re: Callling web page from php
 
proabably javascript is your choice because php cannot handle anything once it is parsed
so you need JS + Ajax would be a good solution if it is dynamic :D


All times are GMT +5.5. The time now is 14:09.