ameliabob Posted October 31, 2012 Share Posted October 31, 2012 I writing some code to make my site respond differently based on iphone/computer/tablet I point to a startup.php<?php $useragent = $_SERVER['HTTP_USER_AGENT']; $a = explode("(",$useragent); $d = explode(";",$a[1]); switch (substr($d[0],0,6)){ case "iPhone": echo("Its an iPhone."); break; case "Window": echo("Its a computer."); break; default: echo("The device called is ".$d[0]." and needs to be added."); }?> I would like to go to a routine in the same directory such as computer_startup.php oriphone_startup.php. replacing the echo statements above. Can I do this in php or do I have to go back and redo this in javascript? Link to comment Share on other sites More sharing options...
justsomeguy Posted October 31, 2012 Share Posted October 31, 2012 You use the header function to send a location header and redirect the browser. http://www.php.net/manual/en/function.header.php 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