title: how to insert data into two tables from one form?
body: <p>well, now, i created a form, and this is it:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body bgcolor="lightblue"&gt;
  
  
  &lt;form align="center" action="connect2.php"  method="post" style="bgcolor:red"&gt;
  
  
          &lt;div style="margin-left:433px" &gt;
          Registration No.: &lt;input type="text" name="reg" /&gt;&lt;br /&gt;
          &lt;/div&gt;
          &lt;/br&gt;
          Name: &lt;input type="text" name="name" size="50" style="margin-left:7px" /&gt;  
          &lt;span style="margin-left:6px"&gt;
          Date of Birth: &lt;input type="text" name="birth" size="30" /&gt;&lt;/br&gt;
          &lt;/span&gt;
              &lt;div style="margin-left:12px"&gt;
                  Age: &lt;input type="text" name="age" size="15" style="margin-left:7px" /&gt;
                  &lt;span style="margin-left:167px"&gt;
                  Class at August 2012 &lt;input type="text" name="class" size="30" /&gt;
                  &lt;/span&gt;
              &lt;/div&gt;
          School: &lt;input type="text" name="school" size="102" style="margin-left:5px" /&gt;
          &lt;/br&gt;&lt;/br&gt;
          Father's Name: &lt;input type="text" name="father" size="94" style="margin-left:5px" /&gt; &lt;/br&gt;
          Father's Occupation: &lt;input type="text" name="focc" size="89" /&gt;
          &lt;/br&gt;&lt;/br&gt;
          Mother's Name:&lt;input type="text" name="mother" size="94" style="margin-left:3px" /&gt; &lt;/br&gt;
          Mother's Occupation: &lt;input type="text" name="mocc" size="88" /&gt;
          &lt;/br&gt;&lt;/br&gt;
  
          &lt;center&gt;
  
              &lt;table bgcolor="pink" width="95" height="100"style="margin-left:0px; margin-top:5px" border="0"&gt;
                  &lt;tr&gt;
                      &lt;td colspan="3"&gt;
                      Siblings, if any:
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr align="center"style="font-weight:bold"&gt;
                      &lt;td width="5"&gt;&lt;/td&gt;
                      &lt;td width="20"&gt;Name&lt;/td&gt;
                      &lt;td width="50"&gt;Age&lt;/td&gt;
                      &lt;td width="20"&gt;School&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr align="right"&gt;
                      &lt;td&gt;1.&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="ssname" size="44" /&gt;&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="sage1" size="5" /&gt;&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="sschool1" size="44" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr align="right"&gt;
                      &lt;td&gt;2.&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="sname2" size="44" /&gt;&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="sage2" size="5" /&gt;&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="sschool2" size="44" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr align="right"&gt;
                      &lt;td &gt;3.&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="sname3" size="44" /&gt;&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="sage3" size="5" /&gt;&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" name="sschool3" size="44" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/center&gt;
          &lt;/br&gt;
          Address: &lt;input type="text" name="address" size="101" /&gt; &lt;/br&gt;
          &lt;p align="left" style="margin-left:271px"&gt;
          Phone Number: &lt;input type="text" name="phone" size="20" /&gt; &lt;/br&gt;
          Cell Number (Mother/Father): &lt;input type="text" name="cp" size="20" /&gt;&lt;/br&gt;
          Email (Mother/Father): &lt;input type="text" name="email" size="28"/&gt;
          &lt;/p&gt;
          &lt;input type="Submit" name="submit" value="submit" /&gt;
  
          &lt;/form&gt;
  
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and then this is my php code:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; 
  &lt;body&gt; 
  &lt;?php
  $con = mysql_connect("localhost","root","");
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  mysql_select_db("sy_database", $con);
  
  $sq$sql="INSERT INTO sy_form (reg_no, name, birth, age, sclass, school, fname, focc, mname, mocc, address, phone, cp, email)
  VALUES('$_POST[reg]','$_POST[name]','$_POST[birth]','$_POST[age]','$_POST[class]','$_POST[school]','$_POST[fname]','$_POST[focc]','$_POST[mname]','$_POST[mocc]','$_POST[address]','$_POST[phone]','$_POST[cp]','$_POST[email]'),
  INSERT INTO siblings(sname,sage,sschool) values('$_POST[ssname]','$_POST[sage1]','$_POST[sschool1]')";
  
  
  if (!mysql_query($sql,$con))
    {
    die('Error: ' . mysql_error());
    }
  
  echo "1 record added";
  
  mysql_close($con);
  ?&gt;
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <p>i need to insert data into two tables from that single form.
  the 1st table are for the person who wants to register and the second is for the siblings of that person.</p>
  
  <p>and how come that the AGE won't appear? and the class at january does not appear also.
  cellphone number would always be 2147483647?</p>
  
  <p>gawd, I'm so ruined!
  could anyone please help me with this? i really want to learn. :(</p>