我想保存此按钮的name=""
部分
<button type="submit" class="btn grey large" id="taxicompany" name="<? echo $rows['company']; ?>">select</button>
所以当我这样做时
<?php echo "".$_SESSION['POSTDATA']['taxicompany'].''; ?>
显示name=""
但它不会显示?
答案 0 :(得分:4)
为什么不给按钮一个值
<button type="submit" class="btn grey large" id="taxicompany" name="taxicompany" value="<? echo $rows['company']; ?>">select</button>
然后,当您提交表单并引用$ _POST ['taxicompany']时,您将获得值
答案 1 :(得分:1)
试试这个:
<form method="post">
<button type="submit" class="btn grey large" id="taxicompany" name="taxicompany" value="your company name">select</button>
</form>
// PHP code
if(isset($_POST['taxicompany']))
{
$_SESSION['POSTDATA']['taxicompany'] = $_POST['taxicompany'];
echo $_SESSION['POSTDATA']['taxicompany']; //your company name
}