title: Form Submission - Using a function within a PHP class to process the form
body: <p>I am using three files on a project: <code>index.php</code>, <code>class.php</code>, and <code>styles.css</code>.</p>
  
  <p>All my functions reside within a php class in the class.php file:</p>
  
  <pre><code>&lt;?php
  
  class Club
  {
      //Private Data
      private $HostName;      //typically "localhost"
      private $UserId;
      private $Password;
      private $DBName;
      private $Con;           //MySQL Connection
      //Public Methods
      //Constructor
      public function __construct($host = NULL, $uid = NULL, $pw = NULL, $db = NULL)
      {
          $this-&gt;HostName = $host;
          $this-&gt;UserID = $uid;
          $this-&gt;Password = $pw;
          $this-&gt;DBName = $db;
  
          //Connect to Database
          $this -&gt; Con = mysqli_connect($host, $uid, $pw, $db);
          if(mysgli_connect_errno($this -&gt; Con))
          {
              echo "Failed to connect to MySQL; " . mysqli_connect_error();
          }
  
      }
      //Destructor
      public function __destruct()
      {
          //Close connection
          mysqli_close($this -&gt; Con);
      }
      public function DisplayMembers()
      {
              }
              function DisplayAbout()
      {
              }
              function DisplayRegistrationForm()
      {
          echo("&lt;h2&gt;Become a Club Member&lt;/h2&gt;
  
          &lt;form name='register' method='post' action=''&gt;
              &lt;table&gt;
                  &lt;tbody&gt;
                      &lt;tr&gt;
                          &lt;td width='80px'&gt;
                              &lt;label&gt;First Name: &lt;/label&gt;
                          &lt;/td&gt;
                          &lt;td width='300'&gt;
                              &lt;input id='firstname' type='text' name='firstname' value='' required/&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;
                              &lt;label&gt;Last Name: &lt;/label&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;input id='lastname' type='text' name='lastname' value='' required/&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;
                              &lt;label&gt;Your Email: &lt;/label&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;input id='email' type='text' name='email' value='' required/&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;
                              &lt;label&gt;Gender: &lt;/label&gt;
                          &lt;/td&gt;
                          &lt;td&gt;
                              &lt;input id='gender' type='radio' name='gender' value='male'&gt;Male&lt;br /&gt;
                              &lt;input id='gender' type='radio' name='gender' value='female'&gt;Female
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td&gt;
                              &lt;label&gt;Interested in: &lt;/label&gt;
                          &lt;/td&gt;
                          &lt;td id='check'&gt;
                              &lt;span style='font-weight: bold;'&gt;Check All that Apply:&lt;/span&gt;&lt;br /&gt;
                              &lt;input id='interests' type='checkbox' name='interests[]' value='Pizza Party'&gt;Pizza Party&lt;br /&gt;
                              &lt;input id='interests' type='checkbox' name='interests[]' value='Joining Study Groups'&gt;Joining Study Groups&lt;br /&gt;
                              &lt;input id='interests' type='checkbox' name='interests[]' value='Visiting Employer Sites'&gt;Visiting Employer Sites&lt;br /&gt;
                              &lt;input id='interests' type='checkbox' name='interests[]' value='Participating in Programming Competition'&gt;Participating in Programming Competitions&lt;br /&gt;
                              &lt;input id='interests' type='checkbox' name='interests[]' value='Building Games'&gt;Building Games&lt;br /&gt;
                              &lt;input id='interests' type='checkbox' name='interests[]' value='Becoming an Officer of the Club'&gt;Becoming an Officer of the Club
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colspan='2' style='text-align: center;'&gt;
                              &lt;input id='submit' type='submit' name='submit' value='Sign Up'/&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;    
          &lt;/form&gt;");
      }
              function ProcessRegistrationForm()
      {
              }
              private function Get_Members_From_DB()
      {
              }
              private function Get_Members_Interests_From_DB($MemberEmail)
      {
              }
              private function Get_Interests_Types_From_DB()
      {
              }
   }
   ?&gt;
  </code></pre>
  
  <p>I cannot for the life of me figure out what to put in the action section of the form portion in order to use the <code>ProcessRegistrationFunction()</code> within the class.  So basically, the <code>DisplayRegistrationForm()</code> is called in the <code>index.php</code> file in a <code>div</code>, and then I want it to be processed by the <code>ProcessRegistrationFunction()</code> within the class. However, I cannot seem to figure out how to do this.</p>