Redirect using textbox value
Posted: Thu Nov 27, 2008 5:45 pm
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hi,
I made a code that takes the value of a text and transfers the user to a page representing what their wrote.
Its like a search form. User types the player name. And when they click the submit button it brings them to the player page.
Here is the coding:
and the input box
But it brings user to the wrong link.
It brings user to:
And I tried removing the script. And when I clicked on submit button, it still went to
Oh and I forgot to precise. These 2 codes are not full files. I use the php funciton include() to bring them toghter for other pages.
This is my code for teh index page:
Thanks for your help,
Ara
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
Hi,
I made a code that takes the value of a text and transfers the user to a page representing what their wrote.
Its like a search form. User types the player name. And when they click the submit button it brings them to the player page.
Here is the coding:
Code: Select all
<script>
function search()
{
name = document.getElementById("inputString").value;
window.location = "http://www.aoe3clan.com/index.php?name=Division1" + name;
}
</script>
Code: Select all
<form name="search">
<div>
Search a Player (Division 1):
<br />
<input type="text" size="30" value="" id="inputString" name="name" onkeyup="lookup(this.value);" onblur="fill();" /> <input type="submit" value="View Player" onClick="search()"/>
</div>
<div class="suggestionsBox" id="suggestions" style="display: none; z-index: 500;">
<div class="suggestionList" id="autoSuggestionsList">
</div>
</div>
</form>
It brings user to:
But it isnt the link I said.
And I tried removing the script. And when I clicked on submit button, it still went to
I took away the OnClick event and it STILL went to the page.... whats wrong? Its impossible that my FTP doesnt work. As everything else I change gets changed.....
Oh and I forgot to precise. These 2 codes are not full files. I use the php funciton include() to bring them toghter for other pages.
This is my code for teh index page:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE> Menu
</TITLE>
<META NAME="Generator" CONTENT="TextPad 4.6">
<META NAME="Author" CONTENT="?">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
<?php include("script.php"); ?>
</HEAD>
<body>
<?php include("nav.php"); ?>
<table width="100%" cellpadding="0" border="0" cellspacing="0">
<tr>
<td style="width:15px; height:33px;" class="story-01"></td>
<td class="story-02">Menu</td>
<td style="width:14px; height:33px;" class="story-03"></td>
</tr>
<tr>
<td style="width:15px;" class="story-04"></td>
<td class="story-05">
<center>
<p>
<span style="font-weight: bold">
<a href="http://www.aoe3clan.com/index.php?name=Division1&file=enter"> Add a Player</a></br>
<a href="http://www.aoe3clan.com/index.php?name=Division1&file=form"> Update a Player</a></br>
<a href="http://www.aoe3clan.com/index.php?name=Division1&file=delete"> Remove a Player</a></br>
<a href="http://www.aoe3clan.com/index.php?name=Division1&file=ladder"> View the Ladder</a></br>
</center>
</td>
<td style="width:14px;" class="story-06"></td>
</tr>
<tr>
<td style="width:15px; height:43px;" class="story-07"></td>
<td class="story-08">
</td>
<td style="width:14px; height:43px;" class="story-09"></td>
</tr>
</table>
</BODY>
</HTML>
Ara
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: