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

x
  • 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?
0
deharvy
Asked:
deharvy
2 Solutions
 
bartvdCommented:
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']
0
 
Ray PaseurCommented:
Please read this page and the pages linked in the online manual:
http://us2.php.net/manual/en/tutorial.forms.php

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
0
 
deharvyAuthor Commented:
Makes sense. Will add a form.
0

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