【发布时间】:2015-08-07 11:54:00
【问题描述】:
我查看了其他看起来像我的问题,但找不到好的答案。所以
$machines = get_machine($platform);
$options = array() ;
$options[0] = "please select";
foreach( (array)$machines as $machine_){
$options[$machine_[0]] = $machine_[1] ;
array_push($temp,$machine_[0]);
}
//print_r($options);
$form->addElement(new Element\Select("Existing machines :", "machine", array("onchange" => "this.form.submit()", "value" => $machine)));
if ( !in_array( $machine, $temp ) )
$machine = 0;
$form->addElement(new Element\Textbox("Add new/Edit machine:", "new_machine", array("placeholder" => "new machine", "shortDesc" => "Add new machine or edit the existing one", "value" => get_machine( $machine ))));
它说“机器”未定义和未初始化 offset 。 这里定义:
if ( isset($_POST['machine']) ) $mask = $_POST['machine']; else $machine = 0;
我有与其他变量完全相同的代码,它并没有给我这种性质的错误。我敢肯定,没有错别字。
【问题讨论】:
-
你可以在你的if条件上面添加这个
$mask = $machine = ""; -
谢谢,这对未定义的部分有所帮助。