hello thr...im trying to insert some records in database table but its doest working. here is my coding. its about addding contact list. i hv created several tables in my database such as efriends, electurer, efamily and so on.. what im i trying to do is ..im trying 2 insert the details in selected tables in database when i choose the selected community. when i run my program its only able to insert the choosen community but the other information such as name,email, address n so on are blank in the database table.. please check the error for me...coz im confused with the coding...
<?
/*$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="KMdb"; // Database name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");// get data that sent from form */
include("condb.php");
// Get values from form.
$name=$POST['name'];
$email=$POST['email'];
$community=$POST['community'];
$home=$POST['home'];
$work=$POST['work'];
$mobile=$POST['mobile'];
$address=$POST['address'];
$city=$POST['city'];
$state=$POST['state'];
//session_register('userID');
//$datetime=date("d/m/y h:i:s");
//create date time
$temp = $GET["community"];
echo "Community : " .$temp;
if ($community == "Lecturers"){
$sql="INSERT INTO electurer(name, email, community, home, work, mobile, address, city, state)VALUES('$name', '$email', '$community', '$home', '$work', '$mobile', '$address', '$city', '$state')";
$result=mysql_query($sql,$connect);
if($result){
echo "Successful<BR>";
}
//}
else if ($community == "Student"){
$sql="INSERT INTO estudent(name, email, community, home, work, mobile, address, city, state)VALUES('$name', '$email', '$community', '$home', '$work', '$mobile', '$address', '$city', '$state')";
$result=mysql_query($sql);
if($result){
echo "Successful<BR>";
}
}
if ($community == "Family"){
mysql_query("insert into efamily(name, email, community, home, work, mobile, address, city, state)VALUES('$name', '$email', '$community', '$home', '$work', '$mobile', '$address', '$city', '$state')");
//$result=mysql_query($sql);
//if($result){
echo "Successful<BR>";
//}
}
else if ($community == "Friends"){
$sql="INSERT INTO efriends(name, email, community, home, work, mobile, address, city, state)VALUES('$name', '$email', '$community', '$home', '$work', '$mobile', '$address', '$city', '$state')";
$result=mysql_query($sql);
if($result){
echo "Successful<BR>";
}
}
else {
echo "ERROR";
}
mysql_close($connect);
?>