title: PHP Notice: Undefined index / PHP Notice: Undefined variable
body: <p>I am really getting frustrated. I am moving my website from php 5.2 to php 5.3. When adding information from my form to the mysql database an empty record is added and I am getting this error messages, which are connected to each other. The error log message is:</p>
  
  <pre><code>[Tue Jul 16 12:37:08 2013] [warn] [client XX.XX.XXX.XXXX] mod_fcgid: stderr: PHP Notice:  Undefined variable: prijs in XXX/page.php on line 100, referer: XXX/page.php
  [Tue Jul 16 12:37:08 2013] [warn] [client XX.XX.XXX.XXXX] mod_fcgid: stderr: PHP Notice:      Undefined index: type_contract in XXX/page.php on line 116, referer: XXX/page.php
  [Tue Jul 16 12:37:08 2013] [warn] [client XX.XX.XXX.XXXX] mod_fcgid: stderr: PHP Notice:  Undefined index: klantnummer in XXX/page.php on line 117, referer: XXX/page.php
  [Tue Jul 16 12:37:08 2013] [warn] [client XX.XX.XXX.XXXX] mod_fcgid: stderr: PHP Notice:  Undefined index: datum in XXX/page.php on line 118, referer: XXX/page.php
  [Tue Jul 16 12:37:08 2013] [warn] [client XX.XX.XXX.XXXX] mod_fcgid: stderr: PHP Notice:  Undefined index: omschrijving in XXX/page.php on line 119, referer: XXX/page.php
  </code></pre>
  
  <p>I have tried everything, like adding </p>
  
  <pre><code>if (isset($_POST['prijs'])) { $prijs = $_POST['prijs']; }
  </code></pre>
  
  <p>The code it is referring to is:</p>
  
  <pre><code>&lt;?php if (isset($_GET['action']) &amp;&amp; ($_GET['action'] == "abonnement_toevoegen")) {
  
  $prijs = $_POST['prijs'];  &lt;=== this is the code is referring to!!!
  
  $prijs_comma = str_ireplace(",", ".", "$prijs");
  
  $prijs = $prijs_comma;
  $btw = $prijs * 0.21;
  $totaal = $prijs + $btw;
  
  $prijs = round($prijs, 2);
  $btw = round($btw, 2);
  $totaal = round($totaal, 2);
  
  $prijs_weergave = str_ireplace(".", ",", "$prijs");
  $btw_weergave = str_ireplace(".", ",", "$btw");
  $totaal_weergave = str_ireplace(".", ",", "$totaal");
  
  include("include_addslashes.php");
  
  $type_contract = $_POST['type_contract']; &lt;=== this is the code is referring to!!!
  $klantnummer = $_POST['klantnummer']; &lt;=== this is the code is referring to!!!
  $datum = $_POST['datum']; &lt;=== this is the code is referring to!!!
  $omschrijving = $_POST['omschrijving']; &lt;=== this is the code is referring to!!!
  
  $sql = "INSERT INTO wi_abonnementen
  (
  type_contract,
  klant_id,
  factuurdatum,
  omschrijving,
  prijs,
  btw,
  totaal
   )
  VALUES
  (
  '$type_contract',
  '$klantnummer',
  '$datum',
  '$omschrijving',
  '$prijs_weergave',
  '$btw_weergave',
  '$totaal_weergave'
  )";
  
  if (!mysql_query($sql, $con)) {
      die('Error: ' . mysql_error());
  }
  
  include("include_stripslashes.php");
  var_dump($_POST);
  ?&gt;
  </code></pre>
  
  <p>Please help, I am getting this error message over and over again with different websites.</p>
  
  <p>The HTML code of the form is:</p>
  
  <pre><code>&lt;form action="finance.php?action=abonnement_toevoegen" method="post"  name="abonnement_toevoegen"&gt;
  &lt;table&gt;
  &lt;tr&gt;
      &lt;td&gt;Type&lt;/td&gt;
      &lt;td&gt;&lt;select name="type_contract" size="1"&gt;
              &lt;option value=""&gt;Kies een optie&lt;/option&gt;
              &lt;option value="tco"&gt;TouringcarOfferte&lt;/option&gt;
              &lt;option value="tao"&gt;TaxiOfferte&lt;/option&gt;
              &lt;option value="wih"&gt;Wi4 Hosting&lt;/option&gt;
              &lt;option value="wii"&gt;Wi4 Internet diensten&lt;/option&gt;
          &lt;/select&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;Klant&lt;/td&gt;
      &lt;td&gt;&lt;select name="klantnummer" size="1"&gt;
              &lt;option value=""&gt;Kies een optie&lt;/option&gt;
                              &lt;option value=""&gt; ()&lt;/option&gt; 
                              &lt;option value="wi126"&gt;XXX (wi126)&lt;/option&gt; 
                              &lt;option value="Wi154"&gt;XXX (Wi154)&lt;/option&gt; 
                              &lt;option value="wi108"&gt;XXX (wi108)&lt;/option&gt;
                          &lt;/select&gt;       
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;Factuurdatum&lt;/td&gt;
      &lt;td&gt;&lt;input class="form" type="Text" name="datum" value="2013-07-17" size="10"&gt;        &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td valign="top"&gt;Omschrijving&lt;/td&gt;
      &lt;td&gt;&lt;textarea class="form" name="omschrijving" cols="25" rows="4"&gt;&lt;/textarea&gt;    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;Prijs (excl. BTW)&lt;/td&gt;
      &lt;td&gt;&amp;#8364; &lt;input class="form" type="Text" name="prijs" value="" size="10"&gt;    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input type="submit" class="form" value="Voeg toe"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  &lt;div id='abonnement_toevoegen_errorloc' class='error_strings'&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Thanx!</p>