ooo i think i might be able to do one better.
if i get you right then this could be a very handy script i made.
you can see it here: http://calm.dansgalaxy.co.uk/link.php
heres that script (all PHP no Javascript in sight!)
here it is minus the design
PHP Code:
<div style="height: auto; margin: 0; width: 100%;"> <? if($_POST['submit']) { $urls = array(); $urls['e1'] = "http://www.swindon-marlborough.nhs.uk"; $urls['e2'] = "http://www.cancerbackup.org.uk/"; $urls['e3'] = "http://www.ubht.nhs.uk/BCH"; $urls['e4'] = "http://www.oxfordradcliffe.nhs.uk"; $urls['e5'] = "http://www.gosh.nhs.uk"; $urls['e6'] = "http://www.clicsargent.org.uk"; $urls['e7'] = "http://www.ukccsg.org.uk"; $urls['e8'] = "http://www.act.org.uk"; $urls['e9'] = "http://www.yct.org.uk"; $urls['e10'] = "http://www.swindonweb.com/"; /******************************************************************************************************* kids links *******************************************************************************************************/ $urls['k1'] = "http://harrypotter.warnerbros.co.uk"; // Harry potter site $urls['k2'] = "http://www.kidsdomain.com/"; $urls['k3'] = "http://www.beanotown.com/"; $urls['k4'] = "http://www.mrmen.com/site/flash/"; $urls['k5'] = "http://www.childrenfirst.nhs.uk/"; $urls['k6'] = "http://www.bbc.co.uk/cbbc/"; $urls['k7'] = "http://www.bbc.co.uk/cbeebies/"; $link = $_POST['link']; $iframe_src = $urls[$link]; } else { $iframe_src = 'http://calm.dansgalaxy.co.uk'; //this is what shows when none is selected and on page load. }
echo ' <form method="post" action="link.php"> <select name="link"> <optgroup label="Useful Links"> <option value="e1" '; if($link == 'e1') {echo'selected="selected"';} echo'>Swindon-Marlborough Nhs Trust</option> <option value="e2" '; if($link == 'e2') {echo'selected="selected"';} echo'>Cancer Back-up</option> <option value="e3" '; if($link == 'e3') {echo'selected="selected"';} echo'></option> <option value="e4" '; if($link == 'e4') {echo'selected="selected"';} echo'></option> <option value="e5" '; if($link == 'e5') {echo'selected="selected"';} echo'></option> <option value="e6" '; if($link == 'e6') {echo'selected="selected"';} echo'>CLIC Sargent</option> <option value="e7" '; if($link == 'e7') {echo'selected="selected"';} echo'></option> <option value="e8" '; if($link == 'e8') {echo'selected="selected"';} echo'></option> <option value="e9" '; if($link == 'e9') {echo'selected="selected"';} echo'></option> <option value="e10" '; if($link == 'e10') {echo'selected="selected"';} echo'>Swindon Web</option> </optgroup> <optgroup label="Kids Links"> <option value="k1" '; if($link == 'k1') {echo'selected="selected"';} echo'>Harry Potter Site</option> <option value="k2" '; if($link == 'k2') {echo'selected="selected"';} echo'>Kids Domain</option> <option value="k3" '; if($link == 'k3') {echo'selected="selected"';} echo'>Beanotown</option> <option value="k4" '; if($link == 'k4') {echo'selected="selected"';} echo'>Mr Men</option> <option value="k5" '; if($link == 'k5') {echo'selected="selected"';} echo'>Children First</option> <option value="k6" '; if($link == 'k6') {echo'selected="selected"';} echo'>CBBC</option> <option value="k7" '; if($link == 'k7') {echo'selected="selected"';} echo'>CBEEBIES</option> <option value="k8" '; if($link == 'k8') {echo'selected="selected"';} echo'></option> </optgroup> </select> <input type="submit" value="Go" name="submit" /> </form> <a href="'; echo $iframe_src; echo'" target="_blank">Open in new window</a>';
echo '<iframe src="'.$iframe_src.'" align="middle" frameborder="1" width="100%" height="700"></iframe> '; ?> <br /> </div>
this shows a dropdown list of links (so you could have all the tutorals in that)
which the select change and it changes the iframe sec, this version also doesnt use $_GET so theres nothing like link.php?fefreuging=gt its plain old llink.php
if however you want to be able to link directly to a tutoral you just change this:
PHP Code:
$link = $_POST['link']; $iframe_src = $urls[$link];
to this
PHP Code:
if(isset($_GET['link'])) { $link = $_GET['link']; } else { $link = $_POST['link']; }
$iframe_src = $urls[$link];
and then if its set it will overrride the post :P
anyway there you go
i wrote this because every one i found like this use Javascript which just dosent work for me, and often didnt work in certian browsers. so this is a 100% sure way of doing it that is 100% browser compat
Hope this helps,
Talkupation Apprieciated
if you want any help to customise it you have my addy 
Dan
__________________
Discounted Web Hosting With XDnet! >> Get 25% of hosting~ Promo: Webmaster-talk <<
|