title: Sticky forms in php zodiac calculator
body: <p>I have a program that when you submit your name and birth day, month, and year it calculates your zodiac sign. I want it so that if you don't submit one piece of info and see the error messages, when you click back your answers are still there (sticky). I've taken a look at some other threads but am having trouble implementing it in my specific situation. Thanks!</p>
  
  <p>Here is my html form:</p>
  
  <pre><code>            &lt;!DOCTYPE HTML&gt;
              &lt;html&gt; 
                  &lt;head&gt;
  
                      &lt;link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' rel='stylesheet' type='text/css'&gt;
  
                      &lt;title&gt;
                      Zodiac
                      &lt;/title&gt;
  
                      &lt;style&gt;
                      body{
                          background-image: url('space.jpg');
                          background-color: Blue;
                          background-size: 100%;
                          font-family: 'Yanone Kaffeesatz', sans-serif;
                          font-size: 150%;
                      }
  
                      form{
                          background-color: LightBlue;
                          border: solid black 3px;
                          width: 35%;
                      }
                      &lt;/style&gt;
  
                  &lt;/head&gt;
              &lt;body&gt;
  
              &lt;center&gt;
                  &lt;br&gt;
                  &lt;br&gt;
                      &lt;form action="zodiacformHandler.php" method="post"&gt;
  
                      &lt;br&gt;
                      &lt;h1&gt;What's your sign?&lt;/h1&gt;
                      &lt;br&gt;
                      Full Name: &lt;input type="text" name="fullName"&gt;&lt;br&gt;
                      &lt;br&gt;
  
                      Month: 
                          &lt;!-- Month dropdown --&gt;
                      &lt;select name="month" size="1"&gt;
                          &lt;option disabled selected&gt;  &lt;/option&gt;
                          &lt;option value="01"&gt;January&lt;/option&gt;
                          &lt;option value="02"&gt;February&lt;/option&gt;
                          &lt;option value="03"&gt;March&lt;/option&gt;
                          &lt;option value="04"&gt;April&lt;/option&gt;
                          &lt;option value="05"&gt;May&lt;/option&gt;
                          &lt;option value="06"&gt;June&lt;/option&gt;
                          &lt;option value="07"&gt;July&lt;/option&gt;
                          &lt;option value="08"&gt;August&lt;/option&gt;
                          &lt;option value="09"&gt;September&lt;/option&gt;
                          &lt;option value="10"&gt;October&lt;/option&gt;
                          &lt;option value="11"&gt;November&lt;/option&gt;
                          &lt;option value="12"&gt;December&lt;/option&gt;
                      &lt;/select&gt;
  
                      Day:
                      &lt;!-- Day dropdown --&gt;
                      &lt;select name="day" size="1"&gt;
                          &lt;option disabled selected&gt;  &lt;/option&gt;
                          &lt;option value="01"&gt;01&lt;/option&gt;
                          &lt;option value="02"&gt;02&lt;/option&gt;
                          &lt;option value="03"&gt;03&lt;/option&gt;
                          &lt;option value="04"&gt;04&lt;/option&gt;
                          &lt;option value="05"&gt;05&lt;/option&gt;
                          &lt;option value="06"&gt;06&lt;/option&gt;
                          &lt;option value="07"&gt;07&lt;/option&gt;
                          &lt;option value="08"&gt;08&lt;/option&gt;
                          &lt;option value="09"&gt;09&lt;/option&gt;
                          &lt;option value="10"&gt;10&lt;/option&gt;
                          &lt;option value="11"&gt;11&lt;/option&gt;
                          &lt;option value="12"&gt;12&lt;/option&gt;
                          &lt;option value="13"&gt;13&lt;/option&gt;
                          &lt;option value="14"&gt;14&lt;/option&gt;
                          &lt;option value="15"&gt;15&lt;/option&gt;
                          &lt;option value="16"&gt;16&lt;/option&gt;
                          &lt;option value="17"&gt;17&lt;/option&gt;
                          &lt;option value="18"&gt;18&lt;/option&gt;
                          &lt;option value="19"&gt;19&lt;/option&gt;
                          &lt;option value="20"&gt;20&lt;/option&gt;
                          &lt;option value="21"&gt;21&lt;/option&gt;
                          &lt;option value="22"&gt;22&lt;/option&gt;
                          &lt;option value="23"&gt;23&lt;/option&gt;
                          &lt;option value="24"&gt;24&lt;/option&gt;
                          &lt;option value="25"&gt;25&lt;/option&gt;
                          &lt;option value="26"&gt;26&lt;/option&gt;
                          &lt;option value="27"&gt;27&lt;/option&gt;
                          &lt;option value="28"&gt;28&lt;/option&gt;
                          &lt;option value="29"&gt;29&lt;/option&gt;
                          &lt;option value="30"&gt;30&lt;/option&gt;
                          &lt;option value="31"&gt;31&lt;/option&gt;
                      &lt;/select&gt;
  
                      Year:
                      &lt;!-- Year dropdown --&gt;
                      &lt;select name="year"  size="1"&gt;
                          &lt;option disabled selected&gt;  &lt;/option&gt;
                          &lt;option value="2014"&gt;2014&lt;/option&gt;
                          &lt;option value="2013"&gt;2013&lt;/option&gt;
                          &lt;option value="2012"&gt;2012&lt;/option&gt;
                          &lt;option value="2011"&gt;2011&lt;/option&gt;
                          &lt;option value="2010"&gt;2010&lt;/option&gt;
                          &lt;option value="2009"&gt;2009&lt;/option&gt;
                          &lt;option value="2008"&gt;2008&lt;/option&gt;
                          &lt;option value="2007"&gt;2007&lt;/option&gt;
                          &lt;option value="2006"&gt;2006&lt;/option&gt;
                          &lt;option value="2005"&gt;2005&lt;/option&gt;
                          &lt;option value="2004"&gt;2004&lt;/option&gt;
                          &lt;option value="2003"&gt;2003&lt;/option&gt;
                          &lt;option value="2002"&gt;2002&lt;/option&gt;
                          &lt;option value="2001"&gt;2001&lt;/option&gt;
                          &lt;option value="2000"&gt;2000&lt;/option&gt;
                          &lt;option value="1999"&gt;1999&lt;/option&gt;
                          &lt;option value="1998"&gt;1998&lt;/option&gt;
                          &lt;option value="1997"&gt;1997&lt;/option&gt;
                          &lt;option value="1996"&gt;1996&lt;/option&gt;
                          &lt;option value="1995"&gt;1995&lt;/option&gt;
                          &lt;option value="1994"&gt;1994&lt;/option&gt;
                          &lt;option value="1993"&gt;1993&lt;/option&gt;
                          &lt;option value="1992"&gt;1992&lt;/option&gt;
                          &lt;option value="1991"&gt;1991&lt;/option&gt;
                          &lt;option value="1990"&gt;1990&lt;/option&gt;
                          &lt;option value="1989"&gt;1989&lt;/option&gt;
                          &lt;option value="1988"&gt;1988&lt;/option&gt;
                          &lt;option value="1987"&gt;1987&lt;/option&gt;
                          &lt;option value="1986"&gt;1986&lt;/option&gt;
                          &lt;option value="1985"&gt;1985&lt;/option&gt;
                          &lt;option value="1984"&gt;1984&lt;/option&gt;
                      &lt;/select&gt;
  
                      &lt;input type="submit"&gt;
  
                      &lt;br&gt;&lt;br&gt;
                  &lt;/form&gt;
  
              &lt;/center&gt;
  
              &lt;/body&gt;
              &lt;/html&gt;
  </code></pre>
  
  <p>And here is my php formHandler:</p>
  
  <pre><code>            &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
              "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
              &lt;html&gt;
                  &lt;head&gt;
                      &lt;title&gt;Zodiac Form Handler &lt;/title&gt;
                      &lt;link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' rel='stylesheet' type='text/css'&gt;
                      &lt;style&gt;
  
  
  
                          body{
                              background-image: url('space.jpg');
                              background-color: LightBlue;
                              background-size: 100%;
                              font-family: 'Yanone Kaffeesatz', sans-serif;
                              font-size: 150%;
                          }
  
                          #forminfo{
                              padding: 25px;
                          }
  
                          img.signs{
                              height: 50%;
                          }
  
  
                      &lt;/style&gt;
                  &lt;/head&gt;
  
  
  
  
                  &lt;body&gt;
  
                      &lt;table id="forminfo" align="center" BGCOLOR="#c6e9ee" style="border:3px solid black"&gt;
                          &lt;tr&gt;&lt;td&gt;
                              &lt;br&gt;
                              &lt;center&gt;
                              &lt;img class="signs" src="signs.png"  align="center"  /&gt;&lt;/a&gt;
                              &lt;h1&gt;Your Astrological Sign:&lt;/h1&gt;
                              &lt;/center&gt;
                              &lt;br&gt;
                              &lt;center&gt;
                              &lt;?php
                              $fullName = $_POST['fullName'];
                              $month = $_POST['month'];
                              $day = $_POST['day'];
                              $year = $_POST['year'];
  
  
                                  $formComplete = True; //boolean variable for if the form is valid or invalid
  
                                  //checks to see if name is filled out. 
                                  if(empty($_POST['fullName'])){
                                      echo "&lt;p class='error'&gt;ERROR: You didn't enter your name. Please go back and try again.&lt;/p&gt;";
                                      $formComplete = False;
                                  }
  
                                  //checks to see if the month is filled out.
                                  if(empty($_POST['month'])){
                                      echo "&lt;p class='error'&gt;ERROR: You didn't enter a month.  Please go back and try again.&lt;/p&gt;";
                                      $formComplete = False;
                                  }
  
                                  //checks to see if dislikes is filled out. 
                                  if(empty($_POST['day'])){
                                      echo "&lt;p class='error'&gt;ERROR: You didn't enter a day. Please go back and try again.&lt;/p&gt;";
                                      $formComplete = False;
                                  }
  
                                  //checks to see if a year is entered. 
                                  if(empty($_POST['year'])){
                                      echo "&lt;p class='error'&gt;ERROR: You didn't enter a year. Please go back and try again.&lt;/p&gt;";
                                      $formComplete = False;
                                  }
  
                              if ($formComplete){
  
                              function zodiac ( $month, $day, $year) 
                              { 
                                 $zodiac = ""; 
  
                                 if     ( ( $month == 3 &amp;&amp; $day &gt; 20 ) || ( $month == 4 &amp;&amp; $day &lt; 20 ) ) { $zodiac = "Aries"; } 
                                 elseif ( ( $month == 4 &amp;&amp; $day &gt; 19 ) || ( $month == 5 &amp;&amp; $day &lt; 21 ) ) { $zodiac = "Taurus"; } 
                                 elseif ( ( $month == 5 &amp;&amp; $day &gt; 20 ) || ( $month == 6 &amp;&amp; $day &lt; 21 ) ) { $zodiac = "Gemini"; } 
                                 elseif ( ( $month == 6 &amp;&amp; $day &gt; 20 ) || ( $month == 7 &amp;&amp; $day &lt; 23 ) ) { $zodiac = "Cancer"; } 
                                 elseif ( ( $month == 7 &amp;&amp; $day &gt; 22 ) || ( $month == 8 &amp;&amp; $day &lt; 23 ) ) { $zodiac = "Leo"; } 
                                 elseif ( ( $month == 8 &amp;&amp; $day &gt; 22 ) || ( $month == 9 &amp;&amp; $day &lt; 23 ) ) { $zodiac = "Virgo"; } 
                                 elseif ( ( $month == 9 &amp;&amp; $day &gt; 22 ) || ( $month == 10 &amp;&amp; $day &lt; 23 ) ) { $zodiac = "Libra"; } 
                                 elseif ( ( $month == 10 &amp;&amp; $day &gt; 22 ) || ( $month == 11 &amp;&amp; $day &lt; 22 ) ) { $zodiac = "Scorpio"; } 
                                 elseif ( ( $month == 11 &amp;&amp; $day &gt; 21 ) || ( $month == 12 &amp;&amp; $day &lt; 22 ) ) { $zodiac = "Sagittarius"; } 
                                 elseif ( ( $month == 12 &amp;&amp; $day &gt; 21 ) || ( $month == 1 &amp;&amp; $day &lt; 20 ) ) { $zodiac = "Capricorn"; } 
                                 elseif ( ( $month == 1 &amp;&amp; $day &gt; 19 ) || ( $month == 2 &amp;&amp; $day &lt; 19 ) ) { $zodiac = "Aquarius"; } 
                                 elseif ( ( $month == 2 &amp;&amp; $day &gt; 18 ) || ( $month == 3 &amp;&amp; $day &lt; 21 ) ) { $zodiac = "Pisces"; } 
  
                                 return $zodiac; 
                              } 
                              echo ("Hello $fullName! Your zodiac sign is: ");
                              echo zodiac ( $month, $day, $year);
  
                              }
  
                              ?&gt;
  
                              &lt;br&gt;&lt;br&gt;
  
                              &lt;a href="zodiac.html" &gt;Choose another date?&lt;/a&gt;
                              &lt;center&gt;
                              &lt;br&gt;
                          &lt;/td&gt;&lt;/tr&gt;
                      &lt;/table&gt;
                  &lt;/body&gt;
              &lt;/html&gt;
  </code></pre>