셀렉트 태그 자동생성

· 14년 전 · 763
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,763
14년 전 조회 672
14년 전 조회 4,779
14년 전 조회 3,392
14년 전 조회 847
14년 전 조회 1,192
14년 전 조회 1,291
14년 전 조회 1,231
14년 전 조회 813
14년 전 조회 2,239
14년 전 조회 961
14년 전 조회 1,615
14년 전 조회 764
14년 전 조회 1,176
14년 전 조회 1,168
14년 전 조회 1,772
14년 전 조회 1,846
14년 전 조회 1,116
14년 전 조회 3,323
14년 전 조회 1,466
14년 전 조회 2,494
14년 전 조회 906
14년 전 조회 2,854
14년 전 조회 1,255
14년 전 조회 1,597