Forum Moderators: coopster
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Green Harbor Bait</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel=stylesheet href="style.css" type="text/css" media=screen>
<!--[if IE ]>
<link href="ie.css" rel="stylesheet" type="text/css">
<![endif]-->
<script type="text/javascript" src="shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({ overlayOpacity: 0.8 });
</script>
<script language="JavaScript" type="text/javascript">
<!--
if (document.getElementById) {
document.writeln('<style type="text/css"><!--')
document.writeln('.texter {display:none} @media print {.texter {display:block;}}')
document.writeln('//--> <!-- </style>') } -->
function openClose(theID) {
if (document.getElementById(theID).style.display == "block") { document.getElementById(theID).style.display = "none" }
else { document.getElementById(theID).style.display = "block" } }
// -->
</script>
<script language="JavaScript">
<!--
function JumpToIt(frm) {
var newPage = frm.url.options[frm.url.selectedIndex].value
if (newPage != "None") {
location.href=newPage
}
}
//-->
</script>
</head>
<body>
<div id="header">
<div id="navwrap">
<table id="nav">
<tr>
<td class="nav-link"><a href="index.php">Home</a></td>
<td class="nav-link"><a href="index.php?page=products">Products</a></td>
<td class="nav-link"><a href="index.php?page=charters">Charters</a></td>
<td class="nav-link"><a href="index.php?page=gallery">Photo Gallery</a></td>
<td class="nav-link"><a href="index.php?page=directions">Directions</a></td>
<td class="nav-link"><a href="index.php?page=contact">Contact Us</a></td>
</tr>
</table>
</div> <!-- END #NAVWRAP -->
</div> <!-- END #HEADER -->
<div id="bodywrap">
<div id="body-content">
<center>
<form>
<select name="url" style="width: 250px; height: 27px; font-size: 18px; font-family: Arial;">
<option value="index.php?page=reels">Reels</option>
<option value="index.php?page=rods">Rods</option>
<option value="index.php?page=lures">Lures</option>
<option value="index.php?page=tackle-line">Terminal Tackle & Line</option>
<option value="index.php?page=tools">Knives & Tools</option>
<option value="index.php?page=bait">Bait</option>
</select>
<input type="submit" style="font-family: Arial;" value="Go!" onClick="JumpToIt(this.form)">
</form>
</center>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Green Harbor Bait</title>
<!-- note no /, you're using an HTML 4 doctype -->
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
<!--[if IE ]>
<link href="ie.css" rel="stylesheet" type="text/css">
<![endif]-->
<style type="text/css">
/* for example, add to your style sheet above */
#url { width: 250px; height: 27px; font-size: 18px; font-family: Arial; }
#submitButton { font-family: arial; }
</style>
<script type="text/javascript">
window.onload=function() {
var obj = document.getElementById('my-form');
// Always check for it first - squeches JS errors
if (obj) {
obj.onsubmit=function() { return JumpToIt(this); };
}
}
//
function JumpToIt(frm) {
var ind = frm.url.selectedIndex;
if (ind==0) { alert('Please select a URL.'); }
else {
document.location = frm.url.options[ind].value;
}
return false;
}
</script>
</head>
<body>
<!-- note the ID, always access unique elements by id for client side scripting -->
<form id="my-form" action="capture-submit.php" method="get">
<select name="url" id="url">
<!-- always lwave first selection blank. This allows you to
error trap and doesn't allow users to just submit without thinking -->
<option value="">Select URL</option>
<option value="index.php?page=reels">Reels</option>
<option value="index.php?page=rods">Rods</option>
<option value="index.php?page=lures">Lures</option>
<option value="index.php?page=tackle-line">Terminal Tackle & Line</option>
<option value="index.php?page=tools">Knives & Tools</option>
<option value="index.php?page=bait">Bait</option>
</select>
<input type="submit" id="submitButton" value="Go!">
</form>
</body>
</html>
<?php
// ALWAYS filter input. This does it by throwing away anything but the values in your array:
$valid = array('reels','rods','lures','tackle-line','tools','bait');
if (isset($_GET['page']) and in_array($GET['page'],$valid)) {
header("Location:index.php?page=".$_GET['page']);
}
else {
echo '<p>Please select an item from the list below.</p>
<form id="my-form" action="capture-submit.php" method="get">
<select name="url" id="url">
<option value="">Select URL</option>
<option value="index.php?page=reels">Reels</option>
<option value="index.php?page=rods">Rods</option>
<option value="index.php?page=lures">Lures</option>
<option value="index.php?page=tackle-line">Terminal Tackle & Line</option>
<option value="index.php?page=tools">Knives & Tools</option>
<option value="index.php?page=bait">Bait</option>
</select>
<input type="submit" id="submitButton" value="Go!">
</form>
';
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Green Harbor Bait</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
<!--[if IE ]>
<link href="ie.css" rel="stylesheet" type="text/css">
<![endif]-->
<style type="text/css">
#url { width: 250px; height: 27px; font-size: 18px; font-family: Arial; }
#submitButton { font-family: arial; }
</style>
<script type="text/javascript">
window.onload=function() {
var obj = document.getElementById('url'); // See difference?
if (obj) {
obj.onchange=function() { return JumpToIt(this); };
document.getElementById('submitButton').style.display='none';
}
}
//
function JumpToIt(selectObject) {
var ind = selectObject.selectedIndex;
if (ind==0) { alert('Please select a URL.'); }
else {
document.location = selectObject.options[ind].value;
}
return false;
}
</script>
</head>
<body>
<form id="my-form" action="capture-submit.php" method="get">
<select name="url" id="url">
<option value="">Select URL</option>
<option value="index.php?page=reels">Reels</option>
<option value="index.php?page=rods">Rods</option>
<option value="index.php?page=lures">Lures</option>
<option value="index.php?page=tackle-line">Terminal Tackle & Line</option>
<option value="index.php?page=tools">Knives & Tools</option>
<option value="index.php?page=bait">Bait</option>
</select>
<input type="submit" id="submitButton" value="Go!">
</form>
</body>
</html>