I have created a simple html form with just two fields and a submit button. The name for the form fields are fullname and country.
On hitting the submit button i am trying to write the data to a textfile, so i created the following php page and set the action of the form to this page.
<html>
<head>
<title>Process</title>
</head>
<body>
<?php
$fName = @$_POST["fullname"];
$Country = @$_POST["country"];
$values = "Name: $fName Country:$Country";
$fp = @fopen("test.txt", "w") or die("Couldn't open file for writing!");
$numBytes = @fwrite($fp, $values) or die("Couldn't write!");
@fclose($fp);
?>
</body>
</html>
However, when i hit the submit button i am getting the die message ("Couldn't open file for writing!")
Can someone point me out what i am doing wrong pls ?
Thanks