A few things: 1. form should be specified method.
<div>
<form action="login_action.php" method="post" >
<label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" >
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lastname" >
</div>
otherwise, the form will be using get method, and there is no data send to $_POST
. refer to http://www.w3schools.com/tags/att_form_method.asp
As @User7 mentioned. The data index in $_POST
is based on the input name, not id
$sql ='INSERT INTO login_info(fname, lname) VALUES ("'.$_POST['firstname'].'","'.$_POST['lasttname'].'")';
if(!mysql_query($sql, $con)){
die('error:'.mysql_error());
}