셀렉트 태그 자동생성

· 14년 전 · 741
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( ' ', '&nbsp;',  $value ) . "</option>";
    }
    $ret .= "</select>";

    return $ret;
  }

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

팁게시판

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

+
제목 글쓴이 날짜 조회
14년 전 조회 4,740
14년 전 조회 646
14년 전 조회 4,754
14년 전 조회 3,367
14년 전 조회 822
14년 전 조회 1,167
14년 전 조회 1,268
14년 전 조회 1,206
14년 전 조회 784
14년 전 조회 2,217
14년 전 조회 935
14년 전 조회 1,589
14년 전 조회 742
14년 전 조회 1,152
14년 전 조회 1,139
14년 전 조회 1,748
14년 전 조회 1,821
14년 전 조회 1,093
14년 전 조회 3,302
14년 전 조회 1,441
14년 전 조회 2,472
14년 전 조회 883
14년 전 조회 2,833
14년 전 조회 1,233
14년 전 조회 1,573
🐛 버그신고