title: undefined variables error message when submitting form data into mysql?
body: <p>i am having trouble inserting my form into mysql. for some reason its not working and displaying this message:</p>
  
  <pre><code>Notice: Undefined index: company_name in C:\xampp\htdocs\hewden_spms\supplier_function\registration_complete.php on line 15
  
  Notice: Undefined index: company_reg_number in C:\xampp\htdocs\hewden_spms\supplier_function\registration_complete.php on line 16
  ERROR
  </code></pre>
  
  <p>can someone show me where i am going wrong please, i have 9 columns in my table but only want to insert company_name and company_reg_number at the minute. so i thought i was doing this right but clearly im missing something.</p>
  
  <p>heres my html:</p>
  
  <pre><code>&lt;form name="myForm" id="myform" action="registration_complete.php" onsubmit="return validateForm()" method="post"&gt;
  
  &lt;input type="text" name="cname"&gt;
  &lt;input type='text' name='creg'&gt;
  
  &lt;input type="submit" id="postme" value="Submit"&gt;
  </code></pre>
  
  <p>php:</p>
  
  <pre><code>&lt;?php
  session_start();
  
  $db_hostname = 'localhost';
  $db_database = 'hewden1'; 
  $db_username = 'root';
  $db_password = '';
  
  $db_server = mysql_connect($db_hostname, $db_username, $db_password)    
          or die("Unable to connect to MySQL: " . mysql_error());
  
  mysql_select_db($db_database)   
  or die("Unable to select database: " . mysql_error());
  
  $cname       = $_POST['company_name'];
  $creg      = $_POST['company_reg_number'];    
  
  
  $sql="INSERT INTO supplier_registration (null, company_name, company_reg_number, null, null, null, null, null, null)
  VALUES ('$cname', '$cname')";$result = mysql_query($sql); 
  
  if($result){
  
  echo "jobs a gooden";
  
  }else {
  echo "ERROR";
  }
  ?&gt;
  </code></pre>
  
  <p>database structure:</p>
  
  <pre><code>table = supplier_registration
  
  column 1 = id
  column 2 = company_name
  column 3 = company_reg_number
  column 4 = address
  column 5 = postcode
  column 6 = email
  column 7 = name
  column 8 = vat
  column 9 = age
  </code></pre>