There is something wrong with my code, but I can't figure out where
<p>My form is this</p>

<pre><code>&lt;form action="" method=""&gt;
&lt;p&gt;&lt;strong&gt;Where's Kay from?&lt;/strong&gt;&lt;/p&gt;  
&lt;select name="country"&gt;

&lt;option value="999"&gt;Select a country&lt;/option&gt;
&lt;option value="001"&gt;Afghanistan&lt;/option&gt;
&lt;option value="002"&gt;Akrotiri&lt;/option&gt;
&lt;/select&gt;


&lt;p&gt;&lt;strong&gt;What's the gender of Kay?&lt;/strong&gt;&lt;/p&gt;
&lt;select name="gender"&gt;

&lt;option value="999"&gt;Select a Gender&lt;/option&gt;
&lt;option value="001"&gt;Male&lt;/option&gt;
&lt;option value="002"&gt;Female&lt;/option&gt;
&lt;option value="999"&gt;Random!&lt;/option&gt;
&lt;/select&gt;


&lt;p&gt;&lt;strong&gt;What topic does Kay likes?&lt;/strong&gt;&lt;/p&gt;
&lt;select name="topic"&gt;

&lt;option value="999"&gt;Select a Topic&lt;/option&gt;
&lt;option value="001"&gt;Normal chat&lt;/option&gt;
&lt;option value="002"&gt;Everything else&lt;/option&gt;
&lt;option value="999"&gt;Random!&lt;/option&gt;
&lt;/select&gt;&lt;br /&gt;
&lt;input type="" value="Chat with Kay!" onclick = "startChat();" /&gt;
&lt;/form&gt;
</code></pre>

<p>and my startChat() is this</p>

<pre><code> function startChat()
   {
   xmlHttp2 = GetXmlHttpObject();

   if (xmlHttp2 == null)
   {
      alert("Browser does not support HTTP Request");
      return;
   }
   var form = document.forms[0]; // or however else you "find" the form on your page
   var country = form.country.value;
   var gender = form.gender.value; 
   var topic = form.topic.value;
   var url = "startChat.php";
   var params = "country=" + encodeURIComponent(country) 
              + "&amp;gender=" + encodeURIComponent(gender)
              + "&amp;topic=" + encodeURIComponent(topic);

   xmlHttp2.open("POST", url, true);
   xmlHttp2.send(params);
   xmlHttp2.onreadystatechange = stateChanged2;
   }

   function stateChanged2()
   {
     if (xmlHttp2.readyState == 4 || xmlHttp2.readyState == "complete")
     {
     userId = trim(xmlHttp2.responseText);

     document.getElementById("chatbox").style.display = 'block';
     document.getElementById("sendbtn").disabled = true;
     document.getElementById("chatmsg").disabled = true;
     document.getElementById("disconnectbtn").disabled = true;

     document.getElementById("intro").style.display = 'none';
     document.getElementById("sayHi").style.display = 'none';

     if (document.getElementById("chatDisconnected") != undefined)
       document.getElementById("chatDisconnected").style.display = 'none';

     if (document.getElementById("startNew") != undefined)
       document.getElementById("startNew").style.display = 'none';

     randomChat();
     }
   }
</code></pre>

<p>and my startChat.php is this</p>

<pre><code> &lt;?php

  include('config.inc.php');
  include('database.inc.php');
  $country = mysql_real_escape_string($_POST['country'], $con);
  $gender = mysql_real_escape_string($_POST['gender'], $con);
  $topic = mysql_real_escape_string($_POST['topic'], $con);
  mysql_query("INSERT INTO users (inchat,preference) values('N','$country')");

  echo mysql_insert_id();

  mysql_close($con);

?&gt;
</code></pre>
