Server IP : 119.59.102.212 / Your IP : 18.117.197.188 Web Server : Apache/2 System : Linux narin 2.6.32-042stab142.1 #1 SMP Tue Jan 28 23:44:17 MSK 2020 x86_64 User : yangkam ( 1022) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/yangkam/domains/yangkam.go.th/public_html/coremain/module/question/ |
Upload File : |
<?php import_request_variables('pG', 'p_'); $sel_q = "select * from cms_question where id_question = '$p_question_id'"; $que_q = mysql_query($sel_q); $obj_q = mysql_fetch_assoc($que_q); $navig['question&id_sub='.$p_id_sub] = $p_sub_name; $navig['question_title'] = 'เพิ่มหัวข้อ'; navigator($navig); echo"<br>"; bar_header($p_sub_name); // Bar_Header fieldset_top($obj_q['topic']); $select = "select * from cms_question_type"; $query = mysql_query($select); while($object = mysql_fetch_array($query)){ $question_type[$object['type_id']] = $object['type_name']; } //debuga($_POST); ?> <table width="97%" border="0" cellpadding="0" cellspacing="0" align="center"> <tr> <td> <center> <FORM NAME='formupdate' METHOD=POST ACTION='index.php?mod=question_choice&path=question' onSubmit='return check()'> <input type="hidden" name="id_sub" value="<?php echo $p_id_sub; ?>" /> <input type="hidden" name="sub_name" value="<?php echo $p_sub_name; ?>" /> <input type="hidden" name="question_id" value="<?php echo $p_question_id; ?>" /> <table width='98%' border='0' cellpadding='0' cellspacing='1' bgcolor='#eff3f7' id="tb_title"> <tr> <td width='25%' height='30' bgcolor='ffffff'> <img src='coremain/images/bullet2.gif'> หัวข้อ</td> <td width='75%' height='30' bgcolor='ffffff'><INPUT TYPE='text' NAME='title' size='50' value=''></td> </tr> <tr> <td height='30' bgcolor='ffffff'> <img src="coremain/images/marker.gif"> ประเภทแบบสำรวจ</td> <td height='30' bgcolor='ffffff'> <select name="question_type"> <option value="">- เลือกประเภท -</option> <?php foreach($question_type as $type_id => $type_name){ ?> <option value="<?= $type_id ?>"><?= $type_name ?></option> <?php } ?> </select> </td> </tr> <tr id="choice_select" style="display: none;"> <td height='30' bgcolor='ffffff'> <img src="coremain/images/marker.gif"> จำนวนตัวเลือก</td> <td><input type="text" name="choice_number" /> ( ตัวเลข ) <button type="button" id="choice_cal" class="ui-corner-all">เพิ่มตัวเลือก</button></td> </tr> </table> <table width="100%" id="bt_question_title" style="display: none;"> <tr> <td> <?php button_text('เพิ่มหัวข้อ', 'Submit', 2); ?> </td> </tr> </table> </FORM> </center> </td> </tr> </table> <script language="javascript"> $('input[name="title"]').focus(); $('select[name="question_type"]').on('change', function(){ var val = $(this).val(); if(val == '2'){ $('#choice_select').css('display', ''); $('#bt_question_title').css('display', 'none'); }else{ $('input[name="choice_number"]').val(''); $('.tr_choice').remove(); $('#choice_select').css('display', 'none'); $('#bt_question_title').css('display', ''); } }); $('input[name="choice_number"]').on('keyup', function(){ if(isNaN($('input[name="choice_number"]').val())){ alert('กรุณากรอกตัวเลขเท่านั้น !'); $(this).select(); $('#choice_cal').attr('disabled', true); }else{ $('#choice_cal').attr('disabled', false); } }); $('#choice_cal').on('click', function(){ $('.tr_choice').remove(); var n = Number($('input[name="choice_number"]').val()); var tr = ''; for(var i = 1; i <= n; i++){ tr += '<tr class="tr_choice"><td height="30" bgcolor="ffffff" align="right"> <img src="coremain/images/marker.gif"> ตัวเลือก '+ i +' : </td><td bgcolor="ffffff"><input type="text" class="choice_no" name="choice_no_'+ i +'" /></td></tr>'; } $('#tb_title').append(tr); $('#bt_question_title').css('display', ''); }); function check() { if($('button[name="Submit"]:visible').length == 1){ if(document.formupdate.title.value=="") { alert("กรุณากรอกหัวข้อ !") ; document.formupdate.title.focus() ; return false ; }else if(document.formupdate.question_type.value=='2'){ var chk_text = true; $.each($('.choice_no'), function(){ chk_text &= $(this).val() == '' ? false : true; }); if(!chk_text){ alert('กรุณากรอกตัวเลือกให้ครบทุกช่อง !'); return false; } }else if(document.formupdate.question_type.value == '5'){ $('form[name="formupdate"]').attr('action', 'index.php?mod=question_output&path=question'); return true; }else{ return true ; } }else{ return false; } } </script>