I would like to make a button that will save the current webpage you are viewing like clicking FILE>SAVE AS in IE, FF, etc. Once clicked you can "precode" the default name of the file based on the variables used in the webpage. Also I if possible I would like to omit certain details on the current webpage from being saved when the save as button is clicked.

So anyone got any ideas on how to make a save as button?

Thanks, Regards X

PS: Even possible to change the default name of IE, FF, etc save as button to your variables on the php page.

Just send a file that represents the page, to the browser.

Some examples can be found here:
http://php.net/manual/en/function.readfile.php

Basically, you're sending the same file, but telling the browser to treat it as a download.

eg:

If the file is example.php

Then in that file, you could have a parameter $_GET.

If it is set to TRUE, then let the browser know that the file is a download.

eg:

<?php

// sample HTML
echo '<p>I am example.php</p>';

?>

To enable that file to be downloaded, put:

<?php

if (isset($_GET['download']) && $_GET['download']) {
// tell browser its a download
header('Content-Disposition: attachment; filename="example.php"');
}

// sample HTML
echo '<p>I am example.php</p>';

?>

Then you just need a add a link on that page:

<a href="index.php?download=1">download</a>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.