amwd07 Posted April 4, 2008 Share Posted April 4, 2008 Can anyone help me with the following: The code below displays only PDF's from a specific folder then on submit enters into the DB This works great but what I need is, if field event_pdf1 displays a PDF this should be shown at the top of the dropdown. If I take out the below code and just echo $eventpdf1, this works but using $eventpdf1 within the functions fails. Anyone have any idea's? ///// Events PDF 1 ///// function eventPDF1($path){ echo "<div class=library_files>"; echo "<select name='event_pdf1' id='event_pdf1'>"; if ($handle = opendir($path)){ while (false !== ($file = readdir($handle))){ if (strpos($file, '.pdf',1)){ $dine = $_GET['dine_id']; $fName = $file; $file = $path.'/'.$file; if(is_file($file)) { // echo "<option value='$eventpdf1' selected='selected'>$eventpdf1</option>"; echo "<option value=''>None</option>"; echo "<option value='$fName'>$fName</option>";}}} closedir($handle);}}echo "</select></div>"; echo $eventpdf1 Link to comment https://forums.phpfreaks.com/topic/99607-php-selected-pdf/ Share on other sites More sharing options...
amwd07 Posted April 4, 2008 Author Share Posted April 4, 2008 To simplify this issue all I am tying to do is show DB variable on the first option of the dropdown within the function. Not sure where I am going wrong. Link to comment https://forums.phpfreaks.com/topic/99607-php-selected-pdf/#findComment-509595 Share on other sites More sharing options...
amwd07 Posted April 5, 2008 Author Share Posted April 5, 2008 This is really simple PHP why won't this work? Link to comment https://forums.phpfreaks.com/topic/99607-php-selected-pdf/#findComment-509838 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.