title: Accessing database for mobile web applications
body: <p>I have a question about login and accessing database for mobile web applications. </p>
  
  <ol>
  <li><p>Namely, the fact that all the pages are usually in one page separated by ids, how do you send form data using PHP? There are no separate files to send data to. </p></li>
  <li><p>Doesn't opening a connection at the top of the HTML file without logging in cause a security problem? If they do not login successfully, you are essentially redirecting to the same HTML file. </p></li>
  </ol>
  
  <p>If someone could redirect to a tutorial (which I can't seem to find online) or give an overview, that would be awesome. </p>
  
  <pre><code>&lt;?php 
  //1. Open connection
  //2. Select database
  ?&gt;
  
  &lt;html&gt;
  &lt;body&gt;
  &lt;section id="page1"&gt;
  &lt;form action="page2" method="POST"&gt;&lt;!-- since the data needs to be send to #page2, do I just POST to the same html file? --&gt;
  &lt;/form&gt;
  &lt;/section&gt;
  
  &lt;section id="page2"&gt;
  &lt;?php 
  //3.query database
  //4. display results 
  ?&gt;
  &lt;/section&gt;
  
  &lt;section id="page3"&gt;
  &lt;/section&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;?php //5. close connection?&gt;
  </code></pre>