i have webpage contains form, following:
<form action=”search.php” method=”post”> <fieldset> <legend> enter search below </legend> <textarea name=”query”> </textarea> </fieldset> </form> the users text read query , search results displayed using code in following section:
if ($_post['query']) { //users query read , results search api displayed } the next thing happens list of synonyms generated, stored in multidimensional array called $synonyms have displayed in left-hand-navigation bar, using code shown below. $newline prints newline (as variable name suggests)
example of $synonyms array:
array(3) { [0]=> array(2) { [0]=> string(9) "chelonian" [1]=> string(17) "chelonian reptile" } [1]=> array(6) { [0]=> string(7) "capsize" [1]=> string(11) "turn turtle" [2]=> string(8) "overturn" [3]=> string(9) "turn over" [4]=> string(8) "tip over" [5]=> string(9) "tump over" } [2]=> array(4) { [0]=> string(4) "hunt" [1]=> string(3) "run" [2]=> string(9) "hunt down" [3]=> string(10) "track down" } } code used output array:
foreach ($synonyms $test) { foreach ($test $test2) { echo $test2.$newline.$newline; } } what want happen is:
turn each synonym clickable link..if user clicks synonym "capsize", word capsize sent section synonym(previously query) read , processed results.. ie. section:
if ($_post['query']) { // synonym read , results search api displayed // 'query' read here // cycle continues again } any ideas or suggestions on 1 great, guys.
you should use in search form. list synonyms shown below
foreach ($synonyms $test) { foreach ($test $test2) { // used <br/> newline printf('<a href="search.php?query=%1$s">%1$s</a><br/>', $test2); } } edit: , obviously, should replace $_post['query'] $_get['query']
Comments
Post a Comment