Forum Moderators: open
Another problem I can't figure out is why there is a trailing "1" at the end of every string in the input field, which it gets from the URL. Whatever I search, a "1" appears at the end of it in the input field, even if the URL is script.php?search= I get a "1" in the input field.
Here is the code I'm using, thanks.
<form action=<?= $PHP_SELF?> method=get>
<input name="search" value=<?= print $_GET['search'];?>>
<input type="submit" value="Search">
</form>
echo "<form action=\"$PHP_SELF\" method=\"get\">\n";
echo "<input type=\"text\" name=\"search\" size=\"25\" value=\"".$_GET['search']."\" /> \n";
echo "<input type=\"submit\" value=\"Search\" /></form>";
On the hiding the?search=, the best I could do was to use JavaScript:
<script language="JavaScript">
if ( location.href == "http://www.domain.com/path/script.php?search=" ) {
location.href = "script.php";
}
</script>
It is doesn't work well though, it only changes the URI after it loads, then reloads which takes a few minutes because the page is large.
echo '<form action="'.$PHP_SELF.'" method="get">
<input type="text" name="search" size="25" value="'.$_GET['search'].'" />
<input type="submit" value="Search" /></form>';
You can echo entire blocks of code though. It will keep your formatting.
echo'
<form action="'. $PHP_SELF .'" method="get">
<input type="text" name="search" size="25" value="'. $_GET['search'] .'" />
<input type="submit" value="Search" />
</form>
';