Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Prompting for User Input Before Download

I'm trying to add a prompt for user input before download of a file.

I'm trying this:

if( strval($_REQUEST['action']) == 'export' )      {
      $szName = prompt("Please enter filename:", "");
      header("Content-Type: application/vnd.ms-excel");
      header("Content-Disposition: attachment; filename=$szName.xls");

prompt doesn't seem to be a valid command.

What is the proper approach?
2 Solutions
Php is server side, so you cannot interact with the user.
You can send the name with a form. If you post the form and you have a textbox with the name 'filename' you can access it via php using $_POST['filename']
Ray PaseurCommented:
Please read this page and the pages linked in the online manual:

That should give you guidance on how to get the client to enter some information that you can use in your script.  After you have read that, if you still have any questions about how to handle this process, please post back here and I will try to help.

Best regards, ~Ray
deharvyAuthor Commented:
Makes sense. Will add a form.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now