爆炸后在复选框中显示值的位置

时间:2013-02-07 23:20:04

标签: php html

下面我有一个文字输入:

'<input type=\"text\" name=\"indivoptions\" class=\"options\" id=\"answer".$option."\" name=\"answerName[$option]\" value=\"$option\" />'

现在我希望在文本输入中爆炸后显示每个$option,而不是一般的字符串输出,但是我将上面的代码放在下面的代码中?

  $options = explode('-', $option);
  if(count($options) > 1) {
    $start = array_shift($options);
    $end = array_shift($options);
    do {
      $options[] = $start;
    }while(++$start <= $end);
  }

当前代码:

function ExpandOptionType($option) { 
  $options = explode('-', $option);
  foreach($options as $answers) {
  $answers = '<p><input type=\"checkbox\" name=\"anstype\" class=\"answers\" id=\"answer".$option."\" name=\"answerName[$option]\" value=\"$option\" />$option</p>';
}
  if(count($options) > 1) {
    $start = array_shift($options);
    $end = array_shift($options);
    do {
      $options[] = $start;
    }while(++$start <= $end);
  }
  else{
    $options = explode(' or ', $option);
  }
  return implode(" ", $options);
}

1 个答案:

答案 0 :(得分:0)

$options = explode('-', $option);
foreach($options as $indivOption) {
  // do something with each option ($indivOption)
}