GORAGOD.com

freelance, web developer, web designer, hosting, domain name

พี่คับอยากให้มัน alert เมื่อคนยังไม่ตอบข้อนี้ทำไงคับ


                   if(!empty($topicid)){
                     if (isset($_POST['submit'])) {
                       // print_r($_POST);       

                         //// CHECK TOPIC STATUS  ////
                         if($status == 'close' && $statusBlock == 'Block'){
                             die(" ไม่สามารถทำแบบสำรวจได้เพราะ หัวข้อสำรวจถูกปิดไม่ให้ใช้งานได้ <br>กรุณารอ 5 วินาทีเพื่อกลับไปหน้าแรก ".goTo('index.php','5')." ");
                         }
                        
                         //// CHECK TOPIC STATUS  ////
                        
                              //// CHECK TOPIC Comment  ////
                         if($Comments != '') {
                                if(session_is_registered('userid'))
                                 {$sqlMemberAnswercustom = "INSERT INTO custom_answerAssess(TopicId, UserId, Date, Custom)VALUES($topicid, $userid, now(),'$Comments')";  
                                mysql_query($sqlMemberAnswercustom);}
                                else
                                {$sqlMemberAnswercustom = "INSERT INTO custom_answerAssess(TopicId, UserId, Date, Custom)VALUES($topicid, null, now(),'$Comments')";  
                                mysql_query($sqlMemberAnswercustom);} }
                                //// CHECK TOPIC Comment  ////
                               
                          $checkAnswer = "Select TopicId From Answer Where UserId = $userid And TopicId = $topicid";
                                 $resultCheck = mysql_query($checkAnswer);
                                  //echo $checkAnswer;
                                  //if(mysql_num_rows($resultCheck)>0){
//                                      die("ได้ทำแบบประเมินนี้ไปแล้ว ".goTo("index.php","3"));
//                                  } 
                      
                            $quizids = $_POST['quizid'];
                            
                            foreach($quizids as $quizid){

                                $answer = $_POST[$quizid];
                               
                               
                             //   if(session_is_registered('userid')){
                               
                                 $sqlMemberAnswer = "INSERT INTO Answer(TopicId, ChoiceId, QuestionId, UserId)VALUES($topicid, $answer, $quizid, $userid)";  
                                 mysql_query($sqlMemberAnswer);
                                
                               
                               
                                //echo "xx :".$answer."<br>";
                                $sqlAnswer = 'UPDATE Choice SET Value = Value+1 WHERE ChoiceId = '.$answer;
                                //echo "<br>".$sqlAnswer;
                                $result_answer = mysql_query($sqlAnswer);
                               
                               
                           // }
                        /// Check Answer
                        mysql_query("UPDATE Topic SET CheckAnswer = '1' WHERE TopicId = $topicid");
                        if($result_answer){
                        //echo "success";
                                
                               
                              
                     }
                     else {
                        echo "fail";?>
                       <SCRIPT LANGUAGE="JavaScript">
                       <!-- Begin
                       alert("กรุณาตอบให้ครบทุกข้อ")
                       // End -->

</script>

                               <?php }      
                    
                     } 
                   } if($result_answer){
                        //echo "success";
                                
                               
                                echo "ขอบคุณค่ะ ที่ตอบ".goTo("index.php","12");
                     }
                     else {
                      
                                } }  
                  

16 มี.ค. 2553 1 1,527

ดูไม่รู้เรือง ครับ...

แนะนำให้ประยุกต์จากตัวอย่างที่ให้ไปนะครับ ถ้าคิดว่าทำไหว แนะนำให้ตรวจด้วย Javascript ก่อนส่งครับ
#1
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 2M
^