我有一个表单,我想在其中使用_POST
数据提交复选框值。我的问题是我的当前页面中已经有帖子值。当我提交表单时,它返回的是当前的帖子值,而不是我想要的,这给了我Notice: Undefined index
信息。
基本上这种形式是比较选定的产品,但在当前的帖子值中,它具有产品信息以及按值排序。有没有办法自己提交我的新表单信息?
谢谢
编辑
好吧,这就是我的代码,我正在使用一个名为 Virtuemart 的购物车。我添加了下面的代码,减去了所有其他不影响表单的内容。
产品档案
// Code here for Template file for individual items in category
//creating checkbox for comparison form
echo "<input type =\"checkbox\" name=\"fruit[]\" value=\"".$product_sku."\" />
<label for=\"".$product_name."\"> ".$product_name."</label>";
分类文件
//all other forms on this page
<form action="items/index.php" method="get" name="results" target="_blank">
<input class="inputbox" name="search" id="item-search" type="text" value="Search"></td><td>
<input type="image" class="sub-button" src="/search.png" alt="submit" name="submit" value="search">
</form>
<form action="index.php" method="get" name="order">
Sort by:
<select class="inputbox" name="orderby" onchange="order.submit()">
<option value="product_list" >Select</option>
<option value="product_name" selected="selected">Product Name</option>
<option value="product_price" >Price</option>
<option value="product_cdate" >Latest Products</option>
</select>
<script type="text/javascript">//<![CDATA[
document.write(' <input type="hidden" name="DescOrderBy" value="ASC" /><a href="javascript: document.order.DescOrderBy.value=\'DESC\'; document.order.submit()"><img src="images/sort_asc.png" border="0" alt="Ascending order" title="Ascending order" width="12" height="12" /></a>');
//]]></script>
<noscript>
<select class="inputbox" name="DescOrderBy">
<option value="DESC">Descending order</option>
<option selected="selected" value="ASC">Ascending order</option>
</select>
<input class="button" type="submit" value="Submit" />
</noscript>
<input type="hidden" name="Itemid" value="89" />
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="page" value="shop.browse" />
<input type="hidden" name="category_id" value="0" />
<input type="hidden" name="manufacturer_id" value="0" />
<input type="hidden" name="keyword" value="" />
<input type="hidden" name="keyword1" value="" />
<input type="hidden" name="keyword2" value="" />
<div id='limitbox'> Display #
<select class="inputbox-reg" name="limit" size="1" onchange="this.form.submit();">
<option value="6" >6</option>
<option value="18" >18</option>
<option value="30" >30</option>
</select>
<input type="hidden" name="limitstart" value="0" /></div> <noscript><input type="submit" value="Submit" /></noscript>
<!-- PAGE NAVIGATION AT THE TOP <br/>
<div style="text-align:center;"> </div>
-->
</form>
// all other forms end
表单我想从中传递值
echo"<form method=\"POST\" name=\"compare\" id=\"compare\" action=\"http://localhost/comparepage/\">";
//TEMPLATE FILE HERE THAT GENERATE PRODUCTS FROM PRODUCT FILE CODE ABOVE.
//Basically it has foreach statements to generate all products
echo "<input type=\"submit\" name=\"submit\" value=\"Compare\" onClick=\"document.compare.submit()\" >";
echo "</form>";
我已更改POST
为GET
仅获取正在传递的值,在下一页中,我在 url 中看到了一堆值。