Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Loading a webpage throught a combo box

  • 31-05-2006 8:55pm
    #1
    Banned (with Prison Access) Posts: 5,154 ✭✭✭


    Hi Folks,
    i'm in the middle of making a photo website for myself. On one of the pages I want to have a lost of bands in a combo box - if the user selects any of the bands it opens that webpage. So selecting, say the item U2 would open the u2.html page.

    What would be my best way to go about this? I know a bit of php if that helps, but I'd rather stick to forms and html if possible.

    Cheers
    S.


Comments

  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Bit of javascript? This would sort you out:

    [HTML]<select name=navigation onChange="go()">
    <option value=''>
    <option value="u2.html">U2
    <option value="strokes.html">The Strokes
    </select>[/HTML]
    function go()
    {
    	box = document.forms[0].navigation;
    	destination = box.options[box.selectedIndex].value;
    	if (destination) location.href = destination;
    }
    


  • Banned (with Prison Access) Posts: 5,154 ✭✭✭Oriel


    Excellent. That did the trick. Thanks for that.
    There's only one obvious thing now though - I'm going to have to copy, paste and update the values into every page that used the combo box. Any ideas to a simple away around this do you reckon?


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Possibly save the navigation box as a seperate html file and simply call it as an included file in each script? I'll have a ponder...


  • Closed Accounts Posts: 2,046 ✭✭✭democrates


    fade_to_grey is bang on.
    Make a header file called header.php and include it atop every page on your site.
    This means your navigation menu etc if changed only need to be changed in one file, then all the pages that include it automatically pick it up.
    Likewise with footer.php at the last in each page if necessary.


  • Moderators, Politics Moderators Posts: 41,234 Mod ✭✭✭✭Seth Brundle


    include files are all well and good - but make sure that your hosting a/c allows for *.shtml (or PHP or ASP or whatever) before designing a site with them


  • Advertisement
  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Que??

    Its just another html file, your host is none the wiser... :confused:


  • Moderators, Politics Moderators Posts: 41,234 Mod ✭✭✭✭Seth Brundle


    which shtml?
    I have come across hosts in the past that don't allow these extensions.
    Anyhow, my point was to check that it is supported. There is no point doing out a site with the following code
    <!-- #include file="head.html" -->
    if he doesn't have ASP, etc.


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Well since he mentioned php something as simple as:

    [PHP]
    <?php

    include 'includedfile.html';

    ?>
    [/PHP]

    would work surely?


  • Closed Accounts Posts: 2,046 ✭✭✭democrates


    I've had failures with includes where SSI was supposedly available,
    but the php 'virtual' command always worked.


  • Moderators, Politics Moderators Posts: 41,234 Mod ✭✭✭✭Seth Brundle


    Well since he mentioned php...
    he said that he knew php - he didn't say that his server supported it. He could be using a free eircom.net a/c for all we know.


  • Advertisement
  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    Fair enough, but rather than debating it between ourselves we should just wait til he comes back to answer our replies, no point in a bust up! :D


  • Banned (with Prison Access) Posts: 5,154 ✭✭✭Oriel


    Folks,
    Yeah, I've coded in php before, it's just that I'm having bother getting 5.14 to work on my MacBook Pro (or any version for that matter). I'm using a php script I wrote a while ago as a contact page - so I've made sure the server is going to be able to handle it. It's just a bollocks having to upload it every time to test it :(

    Thanks for the initial code fade_to_grey - I usually come into contract with javascript when I go to try new things like this :)
    I'll have a go at that menu thing tonight and get back to you :) I should have made it clear that php was an option. To be fiar I've writen sites in php with MySQL databases etc - it's just that it's been a while since I've done it, and the fact that I'm having bother getting it to work on my Mac...


Advertisement