Turn register globals back off. If you have register globals set then you can access your post variables using regular syntax ie: $foo_var but it is not secure or advised. Instead turn register globals off and access your vars thusly: $_POST['foo_var'] as you appear to be doing already.
There are also several typos in your code, I am not sure if that is the code you are running or just typos introduced when posting here but....
try this:
Code:
<?
mysql_connect("localhost","root") or die("Failure on db connection");
mysql_select_db("mydb");
$query = "INSERT INTO sample SET
$name = $_POST['givename'],
$address = $_POST['givenaddress']";
$result = mysql_query($query) or die("Unable to record your info");
print("result:$result");
print("your info has been recorded");
?>
As you can see...there are no quotes around the post variable, otherwise the literal value "$_POST['whatever']" will be used, or perhaps just an error.
I am also unsure of this line:
Code:
print("result:$result");
I don't think that php will interpolate this variable as Perl would. Try this:
Code:
print("result:" . $result);
Good luck.