title: Undefined index: text_unitcost in C:\wamp\www\cdij\insert.php on line 13
body: <p>I am Trying to Insert a value into a table. But I am getting an error:
   Undefined index: text_unitcost in C:\wamp\www\cdij\insert.php on line 13</p>
  
  <p>Insert page is The page through which all the values are Going, Here is the insert page:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;script language="JavaScript" src="myminiAJAX.js"&gt;&lt;/script&gt;
  &lt;script language="JavaScript" src="functions.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  To Insert a new part&lt;br/&gt;
  &lt;form name="insert_values" action="insert.php" method="post"&gt;
      Select The Category&lt;select name="combo_category" id="combo_category" onChange="doAjax('fill_combo_insertpart_combo_assembly.php', 'combo_category='+getValue('combo_category'), 'populate_combo_insertpart_combo_assembly', 'post', '1')"&gt;
      &lt;option value="-1"&gt;--Please Select--&lt;/option&gt;
      &lt;option value="Brake"&gt;Brake&lt;/option&gt;
      &lt;option value="Fastner"&gt;Fastner&lt;/option&gt;
      &lt;option value="Suspension"&gt;Suspension&lt;/option&gt;
      &lt;option value="-1"&gt;--Please Select--&lt;/option&gt;
      &lt;option value="-1"&gt;--Please Select--&lt;/option&gt;
      &lt;option value="-1"&gt;--Please Select--&lt;/option&gt;
      &lt;option value="-1"&gt;--Please Select--&lt;/option&gt;
      &lt;option value="-1"&gt;--Please Select--&lt;/option&gt;
      &lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
      Select The Assembly&lt;select name="combo_assembly" id="combo_assembly" onchange="doAjax('fill_combo_index_and_indexpart_combo_part.php', 'par='+getValue('combo_assembly'), 'populate_combo_index_and_insertpart_part', 'post', '1')"&gt;
      &lt;option value="-1"&gt;--Please Select--&lt;/option&gt;
      &lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
      Select The Part:&lt;select name="combo_part" id="combo_part"&gt;
      &lt;option value="-1"&gt;--Please Select--&lt;/option&gt;
      &lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
      Where Do you want to Insert?&lt;br/&gt;&lt;br/&gt;
      Material&lt;input type="radio" name="radio_insert_table" value="material" onclick="create_form_insertpart_material();doAjax('fill_combo_indexpart_combo_material.php','','populate_combo_insertpart_combo_material','post','1')"/&gt;
      Process&lt;input type="radio" name="radio_insert_table" value="process" onclick="create_form_insertpart_process();doAjax('fill_combo_indexpart_combo_process.php', '', 'populate_combo_insertpart_combo_process', 'post', '1');doAjax('fill_combo_indexpart_combo_multiplier.php', '','populate_combo_insertpart_combo_multiplier', 'post', '1')" /&gt;
      Fastner&lt;input type="radio" name="radio_insert_table" value="fastner"/&gt;
  
      &lt;div id="form" &gt;&lt;/div&gt;
      &lt;br/&gt;&lt;br/&gt;
      &lt;input type="submit" name="ipsubmit" value="Submit"/&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In "<code>&lt;div id="form"&gt;</code>" some new fields are created based on the radio button selection using javascript Here is the Code:</p>
  
  <pre><code>function create_form_insertpart_process() {
      document.getElementById("form").innerHTML="&lt;select name=\"combo_process\" id=\"combo_process\" onChange=\"doAjax('fill_combo_indexpart_combo_process.php','process_name='+getValue('combo_process'),'populate_textbox_insertpart_process_unticost_and_unit','post','1')\"&gt;&lt;option value=\"-1\"&gt;--Please Select--&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt; ";
      document.getElementById("form").innerHTML+="&lt;input type=\"text\" name=\"text_use\" id=\"text_use\" /&gt;";
      document.getElementById("form").innerHTML+="&lt;input type=\"text\" name=\"text_unitcost\" id=\"text_unitcost\" disabled=\"disabled\" /&gt;";
      document.getElementById("form").innerHTML+="&lt;input type=\"text\" name=\"text_unit\" id=\"text_unit\" disabled=\"disabled\" /&gt;";
      document.getElementById("form").innerHTML+="&lt;input type=\"text\" name=\"text_quantity\" id=\"text_quantity\" /&gt;";
      document.getElementById("form").innerHTML+="&lt;select name=\"combo_multiplier\" id=\"combo_multiplier\" onChange=\"doAjax('fill_combo_indexpart_combo_multiplier.php','multiplier_name='+getValue('combo_multiplier'),'populate_textbox_insertpart_multiplier_value','post','1')\"&gt;&lt;option value=\"-1\"&gt;--Please Select--&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt; ";
      document.getElementById("form").innerHTML+="&lt;input type=\"text\" name=\"text_multipliervalue\" id=\"text_multipliervalue\" disabled=\"disabled\"/&gt;";
      window.setInterval("calculate_textbox_insertpart_text_subtotal()",10);
      document.getElementById("form").innerHTML+="&lt;input type=\"text\" name=\"text_subtotal\" id=\"text_subtotal\"  disabled=\"disabled\" /&gt;";
  
  }
  </code></pre>
  
  <p>In The above code:</p>
  
  <pre><code>document.getElementById("form").innerHTML+="&lt;input type=\"text\" name=\"text_unitcost\" id=\"text_unitcost\" disabled=\"disabled\" /&gt;";
  </code></pre>
  
  <p>The value of this fields is generated by a javascript function which returns the database from the server using AJAX and XML</p>
  
  <p>and finally here is the page where I am writing a code to insert the value into database</p>
  
  <pre><code>&lt;?php
      include("dbconfig.inc.php");
       $combo_category=$_POST['combo_category'];
       $combo_assembly=$_POST['combo_assembly'];
       $combo_part=$_POST['combo_part'];
       $radio_insert_table=$_POST['radio_insert_table'];
       if($radio_insert_table=="material") {
  
       }
       else if($radio_insert_table=="process") {
          $combo_process=$_POST['combo_process'];
          $text_use=$_POST['text_use'];
          $text_unitcost=$_POST['text_unitcost'];
          //$text_unit=$_POST['text_unit'];
          //$text_quantity=$_POST['text_quantity'];
          //$combo_multiplier=$_POST['combo_multiplier'];
          //$text_multipliervalue=$_POST['text_multipliervalue'];
          ////$text_subtotal=$_POST['text_subtotal'];
          $select=$dbh-&gt;prepare('INSERT INTO process (process_unitcost) values(:text_unitcost)');
          //$select-&gt;execute(array(':text_unitcost' =&gt; $text_unitcost));
  
       }
  ?&gt;
  </code></pre>
  
  <p>In the above code i am getting an error in line 13 as undefined index text_unitcost</p>
  
  <p>Thanks in advance for help</p>