Opening Word Docs etc from drop down list (Intranet)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Karoti
Forum Newbie
Posts: 3
Joined: Thu Feb 28, 2008 4:07 am

Opening Word Docs etc from drop down list (Intranet)

Post by Karoti »

I have managed to create a list of hyperlinks that work opening any kind of document...

What I would like to do is open docs from a dropdown list... I have poulated the list and it works for pdf's, but for doc or xls files, it fails.

Code: Select all

 
echo "<select name='filelist' id='filelist' onchange=\"window.open(filelist.options[filelist.selectedIndex].value)\"> ";
         echo "<option value='' selected></option>";
         foreach ($filearray as $value) echo "<option value='$path/$value'>$value</option>";
         echo "</select>";
Any help to a relative novice would be gratefully received.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Opening Word Docs etc from drop down list (Intranet)

Post by Chris Corbyn »

What does the generated markup of these failing ones look like? I suspect the PHP output contains some quotes which are breaking the "value" attribute.

Also, it's probably best to use "this" when putting your onchange inline like that:

Code: Select all

window.open(this.options[this.selectedIndex].value);
Karoti
Forum Newbie
Posts: 3
Joined: Thu Feb 28, 2008 4:07 am

Re: Opening Word Docs etc from drop down list (Intranet)

Post by Karoti »

Thanks... what I have realised this morning is that it is only MY pc that it fails to work on, I have tried a dozen or so other pc's on the network and it works perfectly. DRAT!! having spent hours trying to get it to work!

I only now have to find what's different on my pc.
Karoti
Forum Newbie
Posts: 3
Joined: Thu Feb 28, 2008 4:07 am

Re: Opening Word Docs etc from drop down list (Intranet)

Post by Karoti »

It was the Intranet Zone security settings, for some reason my m/c was set higher than the default.
Post Reply