Is there a way to add buttons to a form, I have form that will display up to 6 pictures at a time and need a way to allow the user to select to download the picture. I currently have the user click on the picture to enlarge the view. But I need to be able to associate the picture with the button.
You can simply do the following: <a href="http://downloadLink"><input type="button" value="Download" /></a> PHP: Alternatively, you can use JavaScript onclick event, but do not see the reason in that.
To force a download, you will need to send a header.. i.e. you make a script on the server called download.php (see below) and then you can send the filename in, either via querystring/form post... (make sure you add some security to stop the user downloading ANY file from your system though!) download.php?file=123.jpg <?php $file= $_GET["file"]; // security checks here! - make sure they are only trying to pull a file from the relevant folder Header("Content-Type: application/octet-stream"); require_once $file; ?> PHP: N.B. As stated before, MAKE SURE you add some security in.