Jump to content

form, drop down download


alejandro52

Recommended Posts

Hello, i am trying to create a drop down list witch is inside a form and it is dynamicly created. When the user press the download button of the form to automaticly donwload a pdf.But i dont' kown how to do that. Here is the code

 

This is the form. there us a download button. when it's clicked it goes to pdf.php posting the teuxos id to the pdf.php

     <form id="form1" name="form1" method="post" action="pdf.php">
     <label for="teuxos_drop_down"></label>
     <select name="teuxos" id="teuxos_drop_down">
     	<?php
		while($teuxoi_row = mysql_fetch_array($teuxoi_res)){
			echo "<option value=".$teuxoi_row['teuxos_id'].">" .$teuxoi_row["teuxos"]. "</option>";
		}
	?>
     </select>
     <button> download</button>
   </form>

 

and here what i have on pdf.php. Insead of downloading the file i have it empbedded. But i want to download automaticly when the user clicks the download button

if (isset($_POST['teuxos'])){
	 $teuxos_id = $_POST['teuxos'];
 }else{
	 $teuxos_id= NULL;
 }
 $teuxos_res = mysql_query("SELECT * FROM teuxoi WHERE teuxos_id=".$teuxos_id, $connection); 
if(!$teuxos_res){
	die("Database Query Failed" . mysql_error());
}
$teuxos_row = mysql_fetch_array($teuxos_res);
 ?>
<?php echo "<embed src='".$teuxos_row['teuxos_link']."' width='1000' height='800'/>";
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.