title: How to add action tag to form?
body: <p>I have a working php guestbook script. It's only 1 file. I tried to validate it and there is only one error:</p>
  
  <pre><code>Line 147, Column 36: required attribute "action" not specified
  &lt;form method="post" name="blogform"&gt;
  </code></pre>
  
  <p>Now the code is this and I'm sure I would need to break up the file to two so that I can create a file for the action tag but I just don't know how. Any help is much appreciated.</p>
  
  <pre><code>    &lt;?php
  session_start();
  include("../../4a/inc/opendb.inc.php");
  
  if(isset($_POST['send'])) //checks if $_POST variable "is set"
  
  if(isset($_SESSION["ellenorzo"]) &amp;&amp; !empty($_SESSION["ellenorzo"]) &amp;&amp; $_SESSION["ellenorzo"]==$_POST["code"]){    
  
      $name    = trim($_POST['name']); //eliminating whitespaces
      $email   = trim($_POST['email']);
      $message = addslashes( trim($_POST['message']));
  
      $query = "INSERT INTO blog (name, email, message, date) " .
               "VALUES ('$name', '$email', '$message', NOW())";
      mysql_query($query) or die('Hey, something is wrong!' . mysql_error());
  
      header('Location: ' . $_SERVER['REQUEST_URI']); 
      exit; 
  } 
  ?&gt;
  
  &lt;?php
  include('../../4a/inc/head.inc.php');
  ?&gt;
  
  &lt;body style="color: #ffffff;"&gt;
      &lt;div class="mainblog"&gt;
          &lt;div class="top"&gt;
              &lt;div class="menu"&gt;
                  &lt;?php
                  include('../menu.inc.php');
                  ?&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  &lt;div class="middleblog"&gt;
  
  &lt;form method="post" name="blogform"&gt;
  &lt;input name="name" id="name" class="nameblog" type="text" /&gt;
  &lt;img src="../../4a/img/main/name.jpg" class="name" alt="Name" /&gt;
  &lt;input name="email" id="email" class="emailblog" type="text" /&gt;
  &lt;img src="../../4a/img/main/email.jpg" class="email" alt="Email" /&gt;
  &lt;textarea name="message" id="message" class="messageblog" rows="6" cols="6" onkeyup="return ismaxlength(this)"&gt;
  &lt;/textarea&gt;
  &lt;img src="../../4a/img/main/message.jpg" class="message" alt="Message" /&gt;
  &lt;input name="send" value="submit" id="send" class="sendblog" type="image" src="../../4a/img/main/send.jpg" onclick="return checkform();" /&gt;
  &lt;input type="hidden" name="send" value="submit" /&gt;
  &lt;div class="text_check_code"&gt;
  &lt;font class="text"&gt;
  Enter the characters as they are shown below.
  &lt;/font&gt;
  &lt;/div&gt; 
  &lt;img src="../../4a/inc/secure.inc.php" class="img_check_code" alt="Nospam" /&gt;
  &lt;input name="code" class="input_check_code" /&gt;
  &lt;/form&gt;
  
  &lt;?php
                  $rowsperpage = 10;
                  $pagenumber = 1; 
  
                  if(isset($_GET['page'])) 
                  { 
                      $pagenumber = $_GET['page']; 
                  } 
                  $offset = ($pagenumber - 1) * $rowsperpage; 
  
                  $query = "SELECT id, name, email, message, date ".
                           "FROM blog ".
                           "ORDER BY id DESC ".
                           "LIMIT $offset, $rowsperpage";  
                  $result = mysql_query($query) or die('Hey, something is wrong!. ' . mysql_error()); 
  
                  if(mysql_num_rows($result) == 0) 
                  { 
                  print("&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The blog is empty.");
                  } 
                  else 
                  { 
                      while($row = mysql_fetch_array($result)) 
                      { 
                          list($id, $name, $email, $message, $date) = $row;
  
  
                                          $name    = htmlspecialchars($name);
                                          $email   = htmlspecialchars($email);
                          $message = htmlspecialchars($message);
                          $message = stripslashes(nl2br($message)); //real breaks as user hits enter
  
                  ?&gt; 
  
              &lt;br /&gt;
              &lt;div class="blogentries"&gt;
                      &lt;b&gt;&lt;a href="mailto:&lt;?=$email?&gt;" class="index"&gt;&lt;?=$name?&gt;&lt;/a&gt;&lt;/b&gt;
                      &lt;br /&gt;
                      &lt;?=$message?&gt;
                      &lt;br /&gt;
                      &lt;i&gt;&lt;?=$date?&gt;&lt;/i&gt;
              &lt;/div&gt;
              &lt;br /&gt;
  
              &lt;?php
                  } //closing while statement 
  
              $query   = "SELECT COUNT(id) AS numrows FROM blog";
              $result  = mysql_query($query) or die('Hey, something is wrong!. ' . mysql_error()); 
              $row     = mysql_fetch_array($result, MYSQL_ASSOC); 
              $numrows = $row['numrows']; 
  
              $maxpage  = ceil($numrows/$rowsperpage); //rounding up any integer eg. 4,1=5 
              $nextlink = ''; 
  
              if($maxpage &gt; 1) 
              { 
                  $self     = $_SERVER['PHP_SELF']; 
                  $nextlink = array();
                  for($page = 1; $page &lt;= $maxpage; $page++) 
                  { 
                      $nextlink[] =  "&lt;a href=\"$self?page=$page\"&gt;$page&lt;/a&gt;";
                  }  
                  $nextlink = "Next: " . implode(' » ', $nextlink); //returns all elements of an array as a string
              } 
              include ("../../4a/inc/closedb.inc.php");
              ?&gt;
              &lt;br /&gt;
              &lt;div class="nextlink"&gt;
              &lt;?=$nextlink;?&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;br /&gt;
          &lt;br /&gt;
          &lt;div class="bottomblog"&gt;
              &lt;?php
              require_once('../../4a/inc/copyright.inc.php');
              ?&gt;
          &lt;/div&gt;
          &lt;br /&gt;
          &lt;br /&gt;
      &lt;/div&gt;
      &lt;?php //closing the else statement
      }
      ?&gt;
  
  &lt;?php
  include('../../4a/inc/footer.inc.php');
  ?&gt;
  </code></pre>