셀렉트 태그 자동생성

· 14년 전 · 750
SELECT Tag 자동 생성


function replaceHtmlSelectTag( $name = 'select', $aryValue = Array(), $defaultSelect = '', $aryOption = null)
  {
    $ret = '<select id="'. $name .'" name="'. $name. '"';
    if (isset($aryOption)) {
      foreach ($aryOption as $key => $value) {
        $ret .= ' '. $key . '="'. $value. '"';
      }
    }
    $ret .= '>';

    foreach ( $aryValue as $key => $value ) {
      $default = '';
      if ( strval($key) == strval($defaultSelect) ) {
        $default = ' selected';
      }
      $ret .= '<option value="'. $key . '"';
      $ret .= $default . '>'. str_replace( ' ', ' ',  $value ) . "</option>";
    }
    $ret .= "</select>";

    return $ret;
  }

|
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
14년 전 조회 4,749
14년 전 조회 659
14년 전 조회 4,764
14년 전 조회 3,378
14년 전 조회 832
14년 전 조회 1,178
14년 전 조회 1,277
14년 전 조회 1,216
14년 전 조회 796
14년 전 조회 2,227
14년 전 조회 946
14년 전 조회 1,599
14년 전 조회 751
14년 전 조회 1,161
14년 전 조회 1,149
14년 전 조회 1,759
14년 전 조회 1,831
14년 전 조회 1,104
14년 전 조회 3,311
14년 전 조회 1,452
14년 전 조회 2,482
14년 전 조회 892
14년 전 조회 2,843
14년 전 조회 1,241
14년 전 조회 1,582