You have two possibilitys to do this...
First:
mysqli_query($con,"insert into student(Name) values(" . $_POST['txtname'] . ")");
// using single quotes instead of double quotes
Second
mysqli_query($con,"insert into student(Name) values({$_POST['txtname']})");
//dont use any dots but single quotes and simply add it to the string
Also you should care about some singlequotes to the content...
"... values('{$_POST['txtname']}')"
so it should be
mysqli_query($con,"insert into student(Name) values('{$_POST['txtname']}')");
and as in the comments pointed... you have injection problems and consider to solve this.
Your PHP
<?php
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'foobar');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$stmt = $mysqli->prepare("INSERT INTO students ( Name ) VALUES ( ? )");
$stmt->bind_param('s', $_POST['txtname']);
/* execute prepared statement */
$stmt->execute();
printf("%d Row inserted.\n", $stmt->affected_rows);
/* close statement and connection */
$stmt->close();
/* close connection */
$mysqli->close();
?>