alejandro52 Posted September 14, 2010 Share Posted September 14, 2010 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'/>"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.