【发布时间】:2011-11-22 10:38:34
【问题描述】:
可能重复:
Robust, Mature HTML Parser for PHP
Help coding an HTML Form
这是我想到的设计模型 - http://i.imgur.com/ujiLb.jpg
在每组选项中,只有一个必须被选中,并且根据复选框的组合,“提交”按钮会指向网页。
这两个功能将是
价格(请选择一项)
1-99 100-249 250-499
制造商(请选择一个)
A B C
[提交按钮]
我能理解的肯定是错误的编码是:
//search page
...
<form action='search.php' method='post'>
<input type=radio name=product value='a'>A?</input>
<input type=radio name=product value='b'>B?</input>
<input type=radio name=product value='c'>C?</input>
<br>
<input type=radio name=price value='5'>5-10?</input>
<input type=radio name=price value='10'>11-15?</input>
<input type=radio name=price value='other'>15+?</input>
... </form>
在 search.php 中,类似 ...
<?php
$product = $_POST("product");
$price = $_POST("price");
...
if (($product == "A") && ($price == "5")) {
Location("a-5-10.html"); // Products matching A, price 5-10 etc
elseif (($product == "B") && ($price == "5")) {
Location("b-5-10.html"); //Products matching b, price 5-10 etc
....
endif
?>
根据 OP 的 cmets 进行编辑, 请求没有被重定向到“b-5-10.html”或“a-5-10.html”等。
【问题讨论】: