Page 1 of 1

convert to php code from javascript

Posted: Sat Aug 29, 2009 12:13 am
by ranjitbd
this is a link using codeigniter framework ....and goToTmbd() is a function inside miscellaneous controller:

<a href="<?=base_url()?>miscellaneous/goToTmbd.html">Travelmartbd.com</a>

//this is the function
<?php
class Miscellaneous extends Controller {
function goToTmbd()
{
echo “<script>
var uri = ‘http://www.travelmartbd.com’;
window.location.href=uri;
</script>”;
}
}
?>
//i want to write this function without javascript.i want to do it through pure php

Re: convert to php code from javascript

Posted: Sat Aug 29, 2009 12:33 am
by requinix
Redirection is done with the header function. That page has an example of how to do it.
After you do you must end the script.