Saving Files Echo Statement

Beating my head on desk and have asked around without solution, so I ask here, please:

Ref the generaldemo file “scriptsaveform.php”

echo “Saved to $file successfully!”;

What I wish to do is forward the user to a PHP/HTML page with a message instead of simple message with location.

Can you provide example of code needed to to replace echo statement so can forward to my custom page?

Seems like a very simple process but I have failed miserably:) Much appreciated for any input.

You could use a header redirection to a PHP script that would display your message. See http://php.net/manual/fr/function.header.php

Thank you. Yes I tried that but get errors. Perhaps not placing it correctly in the scriptsaveform.php file.

I understand you do not provide PHP coding support but basic example of placing in scriptsaveform.php file would be greatly appreciated.

Try this:

<?php

$data = trim($_REQUEST[‘data’]);
if (empty($data))
{
die(‘The text field is empty’);
}
$storagelocation = exo_getglobalvariable(‘HEPubStorageLocation’, ‘’);

$file = $storagelocation.‘saveform1.txt’;

exo_setvirtualoption(“3”, “0”);
$fp = fopen($file, “w”) or die(“Couldn’t open $file for writing!”);
exo_setvirtualoption(“3”, “1”);
fwrite($fp, $data) or die(“Couldn’t write values to file!”);

fclose($fp);
//echo “Saved to $file successfully!”;

header(‘Location: http://heserver/thankyou.php?msg=thank+you’);
exit;

?>

And create a thankyou.php script that would display the text in msg with echo ($_GET lets you read msg).