我有以下情况 -
用户单击图像以搜索特定品牌的车辆。然后该图像的值必须进入隐藏框,我会将返回的值发布到另一个表单。我似乎无法获得返回的值...
我的代码...
<form action="searchbrand.php" method="POST" name="frmbrand">
<!--First row of logos...-->
<table class="whitelogo">
<tr>
<td align="center">
<p style="height:5px"></p>
<input type="image" name="brand" id="brand" value="Alfa Romeo" src="images/carlogos/alfa.jpg" height="55px" width="55px" title="View our Alfa Romeo Selection" alt="Alfa Romeo" onClick="javascript:document.submitForm.submit();" />
</td>
<td align="center">
<p style="height:5px"></p>
<input type="image" name="brand" id="brand" value="Aston Martin" src="images/carlogos/aston.jpg" height="55px" width="55px" title="View our Aston Martin Selection" alt="Aston Martin" onClick="javascript:document.submitForm.submit();" />
</td>
<td align="center">
<p style="height:5px"></p>
<input type="image" name="brand" id="brand" value="Audi" src="images/carlogos/audi.gif" height="55px" width="55px" title="View our Audi Selection" alt="Audi" onClick="javascript:document.submitForm.submit();" />
</td>
<td align="center">
<p style="height:5px"></p>
<input type="image" name="brand" id="brand" value="Bentley" src="images/carlogos/bentley.jpg" height="55px" width="55px" title="View our Bentley Selection" alt="Bentley" onClick="javascript:document.submitForm.submit();" />
</td>
<td align="center">
<p style="height:5px"></p>
<input type="image" name="brand" id="brand" value="BMW" src="images/carlogos/bmw.gif" height="55px" width="55px" title="View our BMW Selection" alt="BMW" onClick="javascript:document.submitForm.submit();" />
</td>
<td align="center">
<p style="height:5px"></p>
<input type="image" name="brand" id="brand" value="Cadillac" src="images/carlogos/cadillac.jpg" height="55px" width="55px" title="View our Cadillac Selection" alt="Cadillac" onClick="javascript:document.submitForm.submit();" />
</td>
</tr>
</table>
正如您将在此处注意到的那样,我已将图像命名为“品牌”,每个图像都有单独的值。
<input type="hidden" name="hidbrand" value="<?=$_POST['brand'];?>"/>
</form>
我试图从用户点击的任何图像中捕捉这里的价值......
在我的 searchbrand.php 页面中,它将根据返回的值做一些事情,以下...
<?php
include 'init.php';
$vehicle_brand = $_POST['hidbrand'];
echo $vehicle_brand, '</br>';
?>
什么都没有返回,没有错误,没有价值,像我一样都是空白的 :) 任何人都知道我要去哪里混乱?