Im new with php and im trying to insert data into mysql databas... but i get an error...
need help!
here is my code:
<?php
require ('Connection.php');
//$con = mysql_connect("localhost", "root","") or die('Cant connnect '.mysql_error());
//mysql_select_db("mydb",$con);
//$LNAME=$_POST[txtLname];
//$FNAME=$_POST[txtFname];
//$MINITIAL=$_POST[txtMinitial];
//$BIRTHDATE=NULL;
//$birthdate=($_POST[month],$_POST[day],$_POST[year]);
//$ADD1=$_POST[txtadd1];
//$ADD2=$_POST[txtadd2];
//$COUNTRY=$_POST[txtcountry];
//$CONTACT=$_POST[txtcontact];
//$EMAIL=$_POST[txtemail];
$result = mysql_query("INSERT INTO register (CUSTOMER_NO,LNAME,FNAME,MINITIAL,BIRTHDATE,ADD1,A DD2,COUNTRY,CONTACT_NO,EMAIL)
VALUES(NULL,'$_POST[txtLname]','$_POST[txtFname]','$_POST[txtMinitial]',NULL,'$_POST[txtadd1]','$_POST[txtadd2]','$_POST[txtcountry]','$_POST[txtcontact]','$_POST[txtemail]')",$con);
if(!$result)
{
//header("Location:http://localhost/PhpProject/Index/register.php");
}
// elseif(empty($_POST['txtLname']))
// {
// header("Location:http:");
// }
mysql_close($con)
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="Reg_Css.css" />
</head>
<body bgcolor="#000000">
<div id="container">
<div id="header">
<h1>
<img src="../pix/logo.jpg" />
</h1>
</div>
<div id="navigation">
<ul>
<li><a href="../home.php">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Contact us</a></li>
</ul>
</div>
<div align="left" id="content">
<h2>
Register
</h2>
<p> </p>
<p>
<form name="register" action="register.php" method="post">
<p> <label><span class="style1"> Last Name:</span></label>
<input name="txtLname" type="text" id="txtLname"><label><span class="style1"> First Name:</span></label> <input name="txtFname" type="text" id="txtFname">
<label><span class="style1"> Middle Initial:</span></label> <input name="txtMinitial" type="text" size="1" maxlength="1" id="txtMinitial"></p>
<p> <label><span class="style1"> Birthdate:</span></label>
<select name="month" size="1">
<option> </option>
<option>January</option>
<option>Febuary</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>
<select name="day" size="1">
<option> </option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
<option>13</option>
<option>14</option>
<option>15</option>
<option>16</option>
<option>17</option>
<option>18</option>
<option>19</option>
<option>20</option>
<option>21</option>
<option>22</option>
<option>23</option>
<option>24</option>
<option>25</option>
<option>26</option>
<option>27</option>
<option>28</option>
<option>29</option>
<option>30</option>
<option>31</option>
</select>
<input name="year" type="text" size="5" maxlength="4"/>
</p>
<p> <label><span class="style1"> Address1:</span></label> <input name="txtadd1" type="text" size="80" id="txtadd1"></p>
<p> <label><span class="style1"> Address2:</span></label> <input name="txtadd2" type="text" size="80" id="txtadd2"></p>
<p> <label><span class="style1"> Country:</span></label>
<select name="txtcountry" size="1" id="txtcountry">
<option>-----------</option>
<option>Philippines</option>
<option>North America</option>
<option>Canada</option>
</select>
<span class="style3">(<span class="style5">Optional</span>)</span>
</p>
<p> <label><span class="style1"> Contact No:</span></label> <input name="txtcontact" type="text" id="txtcontact"></p>
<p> <label><span class="style1"> Email:</span></label> <input name="txtemail" type="text" id="txtemail"></p>
<p> <label><span class="style1"> Username:</span></label> <input name="txtuser" type="text" id="txtuser"></p>
<p> <label><span class="style1"> Password:</span></label>
<input name="txtpass" type="password" maxlength="11" id="txtpass">
<span class="style3">(<span class="style5">Max characters 11</span>)</span></p>
<p>
<input name="submit" type="submit" value="submit"></p>
<p> </p>
</form>
</div>
<div id="footer">
Copyright © Snoop Dog and Friends, 2011
</div>
</div>
</body>
</html>