$ _POST在select上未定义

时间:2016-01-04 11:05:56

标签: php post

我在我的Html代码

之上有这个
DataGridViewCellStyle

这是我的html表单

$basisPrijs= array
    (
    array('titel' => 'Kopie', 'uur' => '8'), 
    array('titel' => 'Maatwerk', 'uur' => '10'),
    array('titel' => 'Aangekocht', 'uur' => '12'),
    array('titel' => 'Custom', 'uur' => '14')
    );
if(isset($_POST['emailVerzenden']))
:
$template = $_POST['templates'];
echo $template;
endif; 

这是我拿到按钮的地方

<form action="" method="post">
 <div class="marginTop col-xs-12">
  <label><?php echo $class->template;?></label>
 </div>
 <div class="col-xs-12 col-sm-10 col-md-8 col-lg-6">
  <select id="templates" 
   class="form-control" 
   name="templates">
   <?php foreach($basisPrijs as $key => $value):?>
   <option value="<?php echo $basisPrijs[$key]["uur"];?>">
    <?php echo $basisPrijs[$key]["titel"];?>
   </option><?php endforeach;?>
  </select>
 </div> 
</form>

我一直收到通知:未定义的索引:模板, 有人能解释我的错误。

1 个答案:

答案 0 :(得分:0)

修正了它,我将它们以两种不同的形式存在,我只需要使用一个大表格来处理所有信息。

相关问题