Forums
This topic is locked
select item in list/menu and search db
Posted 25 Jan 2006 12:59:44
1
has voted
25 Jan 2006 12:59:44 kristian Styrvoll posted:
Hi, I have some trouble creating a searchpage using values from a list/menu as input variables to the result page.
An example, if I want to search my mysql db for entries added for selected year, I have created a list/menu and added values 2006 2007. But the step from there to open the result page with all records from selected years I dont manage.
If I create a menu using values directly from the database I'm successfull.
like this:
<?php do { ?>
<tr>
<td><a href="stop/stopViewSearch.php?id_node=<?php echo $row_rsNode['node']; ?>"><?php echo $row_rsNode['node']; ?></a></td>
</tr>
<?php } while ($row_rsNode = mysql_fetch_assoc($rsNode)); ?>
But how could I select a static value in list/menu and pass that as input to the result page?
Regards
Kristian
DWMX | PHP | MYSQL
Replies
Replied 25 Jan 2006 13:51:36
25 Jan 2006 13:51:36 kristian Styrvoll replied:
the static way I have is:
<form id="year" name="year" method="get" action="stop/ stopViewSearchYear.php">
<select name="year" size="2" multiple="multiple" id="year">
<option value="2006">2006</option>
<option value="2007">2007</option>
</select>
<input type="submit" name="Submit" value="Submit" />
</form>
But that gives me this link stop/%20stopViewSearchYear.php?year=2006&Submit=Submit
which is too many variables .. should be stopViewSearchYear.php?year=2006
What have I done wrong?
DWMX | PHP | MYSQL
<form id="year" name="year" method="get" action="stop/ stopViewSearchYear.php">
<select name="year" size="2" multiple="multiple" id="year">
<option value="2006">2006</option>
<option value="2007">2007</option>
</select>
<input type="submit" name="Submit" value="Submit" />
</form>
But that gives me this link stop/%20stopViewSearchYear.php?year=2006&Submit=Submit
which is too many variables .. should be stopViewSearchYear.php?year=2006
What have I done wrong?
DWMX | PHP | MYSQL
Replied 25 Jan 2006 14:01:25
25 Jan 2006 14:01:25 kristian Styrvoll replied:
obs .. there was a _space_ in the beginning of the stopViewSearchYear.php file name. Removed it an now the link works, but
I still get &Submit=Submit, Is there a way to fix this?
stopViewSearchYear.php?year=2006&Submit=Submit
Kristian
DWMX | PHP | MYSQL
I still get &Submit=Submit, Is there a way to fix this?
stopViewSearchYear.php?year=2006&Submit=Submit
Kristian
DWMX | PHP | MYSQL