Our requirement is to write the variables to a text file in append mode. This can be only partially achieved by the below coding.
First two variable - vuserid and vworkorder are obtained from $_GET, this can be written on the page using ECHO command, however using fwrite + $_POST it is not getting written to File. All Other Variables that are as per user response on the page can be written to the file.
<?php
$f = fopen("textfile.txt", "a");
fwrite($f, $_POST["vuserid"] );
fwrite($f, "|");
fwrite($f, $_POST["vworkorder"]);
fwrite($f, "|");
fwrite($f, $_POST["Ques1"]);
fwrite($f, "|");
fwrite($f, $_POST["Ques2"]);
fwrite($f, "|");
fwrite($f, $_POST["Ques3"]);
fwrite($f, "|");
fwrite($f, $_POST["Ques4"]);
fwrite($f, "|");
fwrite($f, $_POST["q14"]);
fwrite($f, ";");
// Close the text file
fclose($f);
echo "Thanks for your Response";
?>
if i understand you correct, you just want put all variables from $_GET to $_POST?
foreach ($_GET as $key => $value) {
$_POST[$key] = $value;
unset($_GET[$key]);
}
print "<pre>";
var_dump($_POST);
print "</pre>";
hope it helps... but at all i think there should be another way to get your vars to your file