title: Get form to submit on same page?
body: <p>Okay so, I've posted this already but still haven't found a solution. I can't seem make my form stay on the same page and I've basically tried EVERYTHING I could possibly think of. </p>
  
  <pre><code>    &lt;?php include("inc\incfiles\header.inc.php"); ?&gt;
      &lt;?php
        $reg = @$_POST['reg'];
         //declaring variables to prevent errors 
           $fn = $ln = $un = $em = $em2 = $pswd = $pswd2 = $d = $u_check = ""; 
  
         /*$fn = ""; //First Name
           $ln = ""; //Last Name
           $un = ""; //Username
           $em = ""; //Email
           $em2 = ""; //Email 2
           $pawd = ""; //:Password
           $pawd2 = ""; //Password 2
           $d = ""; //Sign up Date
           $u_check = ""; //Check if username exists*/
           //registration form
           $fn = mysql_real_escape_string(@$_POST['fname']);
           $ln = mysql_real_escape_string(@$_POST['lname']); 
           $un = mysql_real_escape_string(@$_POST['username']); 
           $em = mysql_real_escape_string(@$_POST['email']); 
           $em2 = mysql_real_escape_string(@$_POST['email2']); 
           $pswd = mysql_real_escape_string(@$_POST['password']); 
           $pswd2 = mysql_real_escape_string(@$_POST['password2']); 
           $d = date("Y-m-d"); //Year - Month - Day 
  
         if ($reg) 
         { 
         //check all of the fields have been filled in
         if ($fn &amp;&amp; $ln &amp;&amp; $un &amp;&amp; $em &amp;&amp; $em2 &amp;&amp; $pswd &amp;&amp; $pswd2) {
  
         }
         else{
         echo "please fill in all fields...";
          }
          }
          ?&gt;
  
         &lt;table class="homepageTable"&gt;
          &lt;tr&gt;
  
      &lt;td width="60%" valign="top"&gt;
      &lt;center&gt;&lt;h2&gt;Join the community today!&lt;/h2&gt;&lt;/center&gt;
  &lt;center&gt;&lt;img src="images/photo.png" width="500"&gt;&lt;/center&gt;
   &lt;form&gt;
  &lt;/td&gt;
  &lt;td width="40%" valign="top"&gt;
  &lt;h2&gt;Get started below...&lt;/h2&gt;  
  &lt;form action="#" method="post"&gt;
        &lt;input type="text" size="25" name="firstname" placeholder="First Name" value="&lt;?php echo $fn; ?&gt;"/&gt;
        &lt;input type="text" size="25" name="lastname" placeholder="Last Name" value="&lt;?php echo $ln; ?&gt;"/&gt;
        &lt;input type="text" size="25" name="username" placeholder="Username" value="&lt;?php echo $un; ?&gt;"/&gt;
        &lt;input type="text" size="25" name="email" placeholder="Email" value="&lt;?php echo $em; ?&gt;"&gt;
        &lt;input type="text" size="25" name="email2" placeholder="Repeat Email" value="&lt;?php echo $em2; ?&gt;"/&gt;
        &lt;input type="password" size="32" name="password" placeholder="Password"/&gt;
        &lt;input type="password" size="32" name="password2" placeholder="Repeat Password"/&gt;&lt;br /&gt;
        &lt;input type="submit" name="reg" value="Sign Up!"/&gt;
  
        &lt;/form&gt;
        &lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;/table&gt;
  </code></pre>
  
  <p>
           </p>
  
  <p>My biggest problem is with the:</p>
  
  <pre><code>&lt;form action="#" method="post"&gt;
        &lt;input type="text" size="25" name="firstname" placeholder="First Name" value="&lt;?php echo $fn; ?&gt;"/&gt;
        &lt;input type="text" size="25" name="lastname" placeholder="Last Name" value="&lt;?php echo $ln; ?&gt;"/&gt;
        &lt;input type="text" size="25" name="username" placeholder="Username" value="&lt;?php echo $un; ?&gt;"/&gt;
        &lt;input type="text" size="25" name="email" placeholder="Email" value="&lt;?php echo $em; ?&gt;"&gt;
        &lt;input type="text" size="25" name="email2" placeholder="Repeat Email" value="&lt;?php echo $em2; ?&gt;"/&gt;
        &lt;input type="password" size="32" name="password" placeholder="Password"/&gt;
        &lt;input type="password" size="32" name="password2" placeholder="Repeat Password"/&gt;&lt;br /&gt;
        &lt;input type="submit" name="reg" value="Sign Up!"/&gt;
  
        &lt;/form&gt;
  </code></pre>
  
  <p>I want to be able to press the submit button and have it stay on the same page. 
  I've tried leaving the  blank I've tried a few other suggestions but I keep coming up with nothing. I've been trying to figure it out for 2 days now and it just won't budge. When pressing the submit button on my site in xampp, it just takes me to another page that says OBJECT NOT FOUND...etc. </p>
  
  <p>If anyone can help, it would be greatly appreciated! I really don't want to have to start all over with my coding just because of one mistake. </p>
  
  <p>Header.inc.php</p>
  
  <pre><code>&lt;?php 
  include("inc/scripts/mysql_connect.inc.php"); 
  ?&gt; 
  &lt;html&gt;
  &lt;head&gt;
  &lt;link href="css\main.css" rel="stylesheet" type="text/css"&gt; 
  &lt;title&gt;website&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="headerMenu"&gt;
   &lt;div id="wrapper"&gt;
        &lt;div class="logo"&gt;
            &lt;img src="images/Logo.png"&gt;
        &lt;/div&gt;
        &lt;div class="search_box"&gt;
              &lt;form method="GET" action="search.php" id="search"&gt;
              &lt;input name="q" type="text" size="60" placeholder="Search..."
              &lt;/form&gt;
        &lt;/div&gt;
        &lt;div id="menu"&gt;
          &lt;a href="#"&gt;Home&lt;/a&gt;
          &lt;a href="#"&gt;About&lt;/a&gt;
          &lt;a href="#"&gt;Sign Up&lt;/a&gt;
          &lt;a href="#"&gt;Log in&lt;/a&gt;
       &lt;/div&gt;
  &lt;/div&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  </code></pre>