title: First HTML/PHP form is giving me a 500 server error
body: <p>My html file:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;title&gt;RSS Form&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  
  &lt;form method='post' action='write.php'&gt;
  &lt;img src='logo.png' align='left' /&gt;
  &lt;font size='6'&gt;RSS Feed&lt;/font&gt;&lt;br&gt;
  The feed that just keeps on giving...&lt;br&gt;
  
  &lt;p&gt;Title:&lt;br&gt;
  &lt;input type='text' name='title' size='84' /&gt;&lt;br&gt;&lt;/p&gt;
  
  &lt;p&gt;Article Body:&lt;br&gt;
  &lt;textarea rows='20' cols='100' wrap='physical' name='desc'&gt;&lt;/textarea&gt;&lt;br&gt;&lt;/p&gt;
  
  &lt;input type='submit' value='Post RSS' name='submit'&gt; &amp;nbsp; (Be sure to review the article before pressing this button -- &lt;b&gt;there's no going back&lt;/b&gt;)&lt;/form&gt;&lt;br&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and Write.php</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;
  &lt;?php
  $file_name = 'rss.xml';
  
  if !(file_exists($file_name)) {
      initialize_xml($file_name);
  }
  
  $rss = fopen($file_name, 'w+') or die('can\'t open file');
  remove_tags($rss);
  write_content($rss);
  close_tags($rss);
  finish();
  
  function initialize_xml($name) {
      $rss = fopen($name, 'w') or die('can\'t open file');
  
      fwrite($rss, "&lt;?xml version=\"1.0\" ?&gt;\n");
      fwrite($rss, "&lt;rss version=\"2.0\"&gt;\n");
      fwrite($rss, "&lt;channel&gt;\n");
      fwrite($rss, "&lt;title&gt;---&lt;/title&gt;\n");
      fwrite($rss, "&lt;description&gt;This feed will keep users up to date on IT issues that may arise&lt;/description&gt;\n");
      fwrite($rss, "&lt;link&gt;---&lt;/link&gt;\n");
      fwrite($rss, "&lt;managingEditor&gt;---&lt;/managingEditor&gt;\n");
      fwrite($rss, "&lt;webMaster&gt;---&lt;/webMaster&gt;\n\n");
  
      close_tags($rss);
      fclose($rss);
  }
  
  function write_content($rss) {
      fwrite($rss, '&lt;item&gt;\n');
      fwrite($rss, '&lt;title&gt;');
      fwrite($rss, $_POST['title']);
      fwrite($rss, '&lt;/title&gt;\n');
  
      fwrite($rss, '&lt;description&gt;');
      fwrite($rss, $_POST['desc']);
      fwrite($rss, '&lt;/description&gt;\n');
  
      fwrite($rss, '&lt;date&gt;');
      $today = getdate();
      $timestamp_format = $today[weekday] + ' ' + $today[month] + ' ' + $today[mday] + ' ' + $today[hours] + ' ' + $today[minutes] + ' ' + $today[seconds];
      fwrite($rss, $timestamp_format);
      fwrite($rss, '&lt;/date&gt;');
  }
  
  function close_tags($rss) {
      fwrite($rss, '&lt;/channel&gt;\n');
      fwrite($rss, '&lt;/rss&gt;\n');
      fwrite($rss, '&lt;/xml&gt;\n');
  }
  
  function remove_tags($rss) {
      // go to end of file
      // remove last 3 lines
  }
  
  function finish() {
      echo 'The article '; 
      echo $_POST['title']; 
      echo ' has been added to the feed.\n';
      echo '&lt;a href="index.html"&gt;Go Back&lt;/a&gt;';
  }
  ?&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>This is my first contact with PHP so I'm quite confused.
  When I go to the html page and "submit" my form, I get redirected to:</p>
  
  <blockquote>
    <p>HTTP Error 500 (Internal Server
    Error): An unexpected condition was
    encountered while the server was
    attempting to fulfil the request.</p>
  </blockquote>
  
  <p>Thanks for your help</p>