Here you go:
HTML Code:
<script type="text/javascript">
var locateTo = function(els){
window.location.href = "page.php?"+els.elements['locate'].value;
};
</script>
<form action="page.php" method="get" onsubmit="locateTo(this); return false; ">
<input type="text" name="locate"/><input type="submit" />
</form>
You should also make this compatible with javascript disabled users. To do this, on page.php, add:
PHP Code:
<?php
if(isset($_GET['locate'])) {
header("Location: ".$_SERVER['PHP_SELF']."?".$_GET['locate']);
}
?>
Of course - if you do that then all you need to do with the <form> I gave you 2 codes above is:
HTML Code:
<form action="page.php" method="get">
<input type="text" name="locate"/><input type="submit" />
</form>
Which I highly suggest.
Bookmarks