thanks for the response sir
PaulS:
Lets start with why you want to POST data. GET is far simpler conceptually. POST is necessary if you wish to hide the data being posted.The body of the POST is "text=HELLO WEBSITE". How did you come to the conclusion that you would access that data using $_POST['words']?
sorry forget to change its "words=HELLO WEBSITE"
i get the conclusion from my project before, and i read it from some website sensor send data to php
my project before is buttons control led
example for the php file
<?php
header('Location: index.html');
$path = 'data.txt';
if (isset($_POST['field1']))
{
$fh = fopen($path,"w");
$string = $_POST['field1'];
fwrite($fh,$string);
fclose($fh);
}
?>
in the index.html i write form post method and a button. and the index.html give a value to php file in 'field1'
and I conclude if i POST "words=HELLO WEBSITE" it will give a variable to $words and i thought it will access that data , and write it to file 'text.log'
with this code
<?php
$handle = fopen('text.log', 'w');
fwrite($handle, date('d/m/Y H:i:s') . " - " . $_POST['words']) . "\n";
fclose($handle);
?>
what should i do sir ?