I have code that builds a page of dog information which includes a "name=" tag for each dog. The code also builds an array of dog names ($dogname).
The following code is then supposed to create a simple form allowing the user to select a name from a list and click the "Find" button to go to the appropriate tag.
Everything works as designed except the "find" function - I've spent many hours trying to get the syntax of this right without success. I've tried building the input button code both inside and outside the PHP. Here's the current version:
The page as it currently stands can be seen at: http://www.greyhoundpets.com/Test2.php
Thanks for any help you can give.
The following code is then supposed to create a simple form allowing the user to select a name from a list and click the "Find" button to go to the appropriate tag.
Everything works as designed except the "find" function - I've spent many hours trying to get the syntax of this right without success. I've tried building the input button code both inside and outside the PHP. Here's the current version:
Code:
<?php
echo "<form><label for='user'>Or, find a dog by name:</label>\n
<select name='findname' id='findname' class='selectOne'>\n
<option value=''>Select name</option><option value=''>---------------</option>\n";
sort($dogname);
foreach ($dogname as $thisdog) {
echo "<option value='$thisdog'>$thisdog</option>\n";
}
echo "</select>\n";
?>
<input type="button" value="Find" onClick='location.href=document.referrer+ "#" + dogname.value';/></form>
Thanks for any help you can give.
Comment