title: Iphone detection php
body: <p>I have several Index.php files, such as (index.php, index2.php, index3.php etc.), I also have a database with different ID URL's. when some one enters a index file, the landing pages the see are dynamic and only the specified parameters in the database changes some of the parameters on display, lets say i enter domain.com/index.php?id=2 - this is for X city and the domain domain.com/index2.php?id=112 will display a page for Y city. </p>
  
  <p>So far so Good..</p>
  
  <p>now i am trying to insert a Iphone detection code, that will redirect users that are entering the urls from iphone to an iphone friendly design. so i created an i-index.php inserted the following code into the index.php page:</p>
  
  <pre><code>&lt;?
  if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod'))
  {
    header('Location: http://www.mydomain.com/mobile/i-index.php');
    exit();
  }
  ?&gt;
  </code></pre>
  
  <p>and now when i enter the url mydomain.com/index.php?id=1 from my iphone i am redirected to the i-index.php file but not to the specified ID (?id=1).</p>
  
  <p>i hope my explanation is not to confusing. can anyone suggest a way for it to redirect to the specified ID (both original index and the mobile index are connected to the database correctly)</p>
  
  <p>Thank you</p>