고정값 ==> 변수로 바꾸려는데.. 잘못 입력한건지? 아니면 쓸수 없는건지? 채택완료
비흔님께서 3단 분류를 스킨을 제공해주셨는데요
http://sir.kr/g5_skin/5192">http://sir.kr/g5_skin/5192
감사하게 사용중입니다.
php 특성상 안 되는건지? 아니면 변수 처리를 잘못하는건지? ...문의드립니다.
1차분류, 2차분류, 3차 분류...구분을 하도록 하는 코드입니다.
원소스) 2차분류에서 아래 빨깐색, medium_div_change 부분은 함수 호출되는 고정값입니다.
<select name="wr_2" onChange="div_send('fwrite',this.name,this.value,'wr_3','medium_div_change',true)">
이부분을 변수로 변경하고자 합니다.
게시판 테이블 xxx01, xxx02, xxx03, xxx04 ...이런식입니다.
<?php $aaa = "medium_div_".$bo_table."";?>
<select name="wr_2" onChange="div_send('fwrite',this.name,this.value,'wr_3','$aaa',true)">
게시판마다 자신의 bo_table 값과 결합해서 $aaa값이
호출할 때 사용할 수 있도록 $aaa으로 변수처리하였습니다.
$aaa를 echo로 출력하면, medium_div_xxx01 이런식으로 정상적으로 변환되는데요...
onChange = "div_send(........)" 함수 내 변수로 처리는 못하는건가요?
(원소스)
</span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> <select name="wr_1" onchange="div_send('fwrite',this.name,this.value,'wr_2','big_div_change',true)"> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> <option value="">1차 분류 선택</option> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> <?php </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $Big_Sql = " select * from g5s_BigDiv order by BigDivOrder asc "; </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $Big_Result = sql_query($Big_Sql); </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> for ($i=0; $Big_Row=sql_fetch_array($Big_Result); $i++) </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> { </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> if($write['wr_1'] == $Big_Row['BigDivNo']) </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $BigSelected = 'selected'; </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> else </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $BigSelected = ''; </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> echo(" <option value='".$Big_Row['BigDivNo']."' ".$BigSelected.">".$Big_Row['BigDivName']."</option> "); </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> } </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> ?> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> </select> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> <select name="wr_2" onChange="div_send('fwrite',this.name,this.value,'wr_3','medium_div_change',true)"> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> <option value=''>1차 분류선택</option> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> <?php </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $Where_Med_Query = " where BigDivNo='$write[wr_1]'"; </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $MediumDiv_Sql = " select * from g5s_MediumDiv ".$Where_Med_Query." order by MediumDivNo "; </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $MediumDiv_Result = sql_query($MediumDiv_Sql); </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> for ($i=0; $MediumDiv_Row=sql_fetch_array($MediumDiv_Result); $i++) </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> { </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> if($write['wr_2'] == $MediumDiv_Row['MediumDivNo']) </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $MedSelected = 'selected'; </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> else </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> $MedSelected = ''; </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> echo(" <option value='".$MediumDiv_Row['MediumDivNo']."' ".$MedSelected.">".stripslashes($MediumDiv_Row['MediumDivName'])."</option> "); </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> } </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> ?> </span><br style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px;"><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;"> </select> </span> </p><p><span style="color: rgb(127, 127, 127); font-family: 나눔고딕, NanumGothic; font-size: 12px;">
원소스를 아래와 같이 사용하려고 함
<?php $aaa = "medium_div_".$bo_table."";?>
<select name="wr_2" onChange="div_send('fwrite',this.name,this.value,'wr_3','$aaa',true)">
답변 1개
온체인지 명령어 뒤에 ; 가 빠져있는것 아닌가요?;;
</strong></span></p><p><font face="Courier New"><span style="font-family: 돋움,dotum; font-size: 11pt;"><select name=</span></font><code class="php string"><span style="font-family: 돋움,dotum; font-size: 11pt;">"wr_1"</span></code><span style="font-family: 돋움,dotum; font-size: 11pt;"> </span><code class="php plain"><span style="font-family: 돋움,dotum; font-size: 11pt;">onchange=</span></code><code class="php string"><span style="font-family: 돋움,dotum; font-size: 11pt;">"div_send(</span><span style="font-family: 돋움,dotum; font-size: 11pt;">'fwrite',this.name,this.value,'wr_2','big_div_change',true);"</span></code><code class="php plain"><span style="font-family: 돋움,dotum; font-size: 11pt;">> </span></code></p><p><span style="font-family: 돋움,dotum; font-size: 11pt;">
그래도 안되면 이렇게 해보세요.
</strong></span></p><p><font face="Courier New"><span style="font-family: 돋움,dotum; font-size: 11pt;"><select name=</span></font><code class="php string"><span style="font-family: 돋움,dotum; font-size: 11pt;">"wr_1"</span></code><span style="font-family: 돋움,dotum; font-size: 11pt;"> </span><code class="php plain"><span style="font-family: 돋움,dotum; font-size: 11pt;">onchange=</span></code><code class="php string"><span style="font-family: 돋움,dotum; font-size: 11pt;">"<span style="font-family: 돋움,dotum; font-size: 11pt;"><strong>javascript:</strong></span>div_send(</span><span style="font-family: 돋움,dotum; font-size: 11pt;">'fwrite',this.name,this.value,'wr_2','big_div_change',true);"</span></code><code class="php plain"><span style="font-family: 돋움,dotum; font-size: 11pt;">> </span></code></p><p><span style="font-family: 돋움,dotum; font-size: 11pt;">
답변에 대한 댓글 2개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
특정한 스트링이 입력되어 있을 때는, 'big_div_change' 는 정상실행됩니다.
제가 big_div_change를 게시판 테이블 정보 $bo_table 값으로 함수를 call하려고..수정하는데요
전혀 응답이 없어서
즉,
<?php $aaa = "medium_div_".$bo_table."";?>
<select name="wr_2" onChange="div_send('fwrite',this.name,this.value,'wr_3','$aaa',true)">
함수 내 변수로는 처리안되는건가요?