title: PHP header redirect loop
body: <p>I am having a problem where a user is able to submit an event to a calender but I cannot get them redirected back to the original page. I have tried using:</p>
  
  <pre><code>  header("Location: http://localhost/Project/View/Home.php");
    exit;
  </code></pre>
  
  <p>But I am getting a message <code>This webpage has a redirect loop</code></p>
  
  <p>HTML - Home.php</p>
  
  <pre><code>&lt;!DOCTYPE html&gt; 
  &lt;html lang="en"&gt; 
    &lt;head&gt; 
      &lt;meta charset="utf-8" /&gt; 
      &lt;link rel="stylesheet" href="Common.css" /&gt;
      &lt;script src="jquery.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="functions.js"&gt;&lt;/script&gt;
      &lt;!--Includes HTML5 Shiv for all versions of IE to solve compatability issues--&gt; 
      &lt;!-- &lt;title&gt;&lt;/title&gt;--&gt;
  &lt;?php include '../Controller/Cal.php'?&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;form action="../Controller/Cal.php" method="post"&gt;
        Content: &lt;input type="text" name="Content" /&gt;
        &lt;input type="submit" /&gt;
      &lt;/form&gt;
      &lt;header&gt;
      &lt;iframe src="https://www.google.com/calendar/embed?src=dnavechicleservices%40gmail.com&amp;ctz=Europe/London" 
      style="border: 0" width="1000" height="600" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;
      &lt;/header&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>PHP - Cal.php</p>
  
  <pre><code>&lt;?php 
    $path = '/opt/lampp/htdocs/Project/ZendGdata-1.12.0/library';
    $oldPath = set_include_path(get_include_path() . PATH_SEPARATOR . $path);
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    Zend_Loader::loadClass('Zend_Gdata_Calendar');
    // User whose calendars you want to access
    $user = 'email@gmail.com';
    $pass = 'password';
    $serviceName = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar
    $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $serviceName);
    $service = new Zend_Gdata_Calendar($client);
    // Create a new event object using calendar service's factory method.
    // We will then set different attributes of event in this object.
    $event= $service-&gt;newEventEntry();
    // Create a new title instance and set it in the event
    $event-&gt;title = $service-&gt;newTitle("Service");
    $event-&gt;content = $service-&gt;newContent(isset($_POST["Content"]));
    // Create an object of When and set start and end datetime for the event
    $when = $service-&gt;newWhen();
    // Set start and end times in RFC3339 (http://www.ietf.org/rfc/rfc3339.txt)
    $when-&gt;startTime = "2012-10-20T16:30:00.000+05:30"; // 8th July 2010, 4:30 pm (+5:30 GMT)
    $when-&gt;endTime = "2012-10-20T17:30:00.000+05:30"; // 8th July 2010, 5:30 pm (+5:30 GMT)
    // Set the when attribute for the event
    $event-&gt;when = array($when);
    // Create the event on google server
    $newEvent = $service-&gt;insertEvent($event);
    // URI of the new event which can be saved locally for later use
    $eventUri = $newEvent-&gt;id-&gt;text;
    header("Location: http://localhost/Project/View/Home.php");
    exit;
  ?&gt;
  </code></pre>