2016-09-16 12 views
0

ここで私はこれがフォームであり、我々はdb、私たちに挿入しながら、フォームを送信した後、コントローラフォーム送信フォームの後に成功ポップアップが表示されますか?

public function general_form() 
{ 
    $post = $this->input->post(); 
    unset($post['send_contact_enq']); 
    $insert_id = $this->custom_db->insert_record('corporate_form_reqlist',$post); 
    redirect(base_url()."general/index"); 
} 

にINSERTクエリを追加

<a class="handCursor " href="javascript:void(0)" id="franchise">Franchisee </a> 
<!-- Modal --> 
<div class="modal fade" id="franchisee_signup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
     <form action="<?php echo base_url();?>general/general_form" method="POST" name="signup"> 
      <div class="modal-header bg-primary"> 
       <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> 
       <h4 class="modal-title" id="myModalLabel"><i class="fa fa-desktop"></i> Request For Franchisee Program</h4> 
      </div> 
      <div style="clear: both;"></div> 
      <div class="modal-body clearfix"> 
       <div class="bk_lft" style="width:100%;"> 
        <div class="bk_gr" style="width:100% !important"> 
        <div class="contact_form2"> 
         <div class="bk_roominfo"> 
          <div class="clearfix"></div> 
          <div class="frm_clmn"> 
           <label>First Name: <em style="color:#F00;">*</em></label> 
           <input name="first_name" id="txt_name" type="text"> 
           <input name="form_type" id="company_name" type="hidden" value="franchise"> 
          </div> 
          <div class="frm_clmn1"> 
           <label>Last Name: <em style="color:#F00;">*</em></label> 
           <input name="last_name" id="txt_lname" type="text"> 
          </div> 
          <div class="frm_clmn"> 
           <label>Phone: <em style="color:#F00;">*</em></label> 
           <input name="mobile" id="txt_mobile" type="text"> 
          </div> 
          <div class="frm_clmn1"> 
           <label>Email: <em style="color:#F00;">*</em></label> 
           <input name="email" id="txt_email" type="text"> 
          </div> 
          <div class="frm_clmn1" style="width:100%;"> 
           <label>Message:<em style="color:#F00;">*</em></label> 
           <textarea name="message" id="txt_message" cols="" rows="" style="resize:none;"></textarea> 
          </div> 
          <div class="bk_bt" style="float:left; margin-top:12px;"> 
           <button type="submit" name="send_contact_enq" id="send_contact_enq" value="Continue" style="float:left;">Send</button> 
          </div> 
         </div> 
        </div> 
        <div class="clearfix"></div> 
        </div> 
       </div> 
      </div> 
     </form> 
     </div> 
    </div> 
</div> 

CodeIgniterのビューのページにデータモデルとの一つの形を追加しましたフロントページにリダイレクトします。コントローラからリダイレクトする前に、ポップアップメッセージのリダイレクトが発生した後に成功のポップアップを表示することが可能であるかどうかを確認する必要があります。

我々は

redirect(base_url()."general/index?status=success"); 

と、一般的に..私が知っているすべての私のロジックを試みたが、

+0

....ます。https:/ /www.codeigniter.com/user_guide/libraries/sessions.html –

+0

私もその1つを試しました $ this-> session-> set_flashdata( 'success_msg'、 '管理者に設定がリクエストされました。 しかし、それは得ない – Vigneshrajkumar

+0

あなたがOKまたはクローズボタンのクリックで成功メッセージをポップアップできる場合は、この 'window.location =" http://www.yoururl.com ";を追加してください; –

答えて

0
if($insert_id=='success'){//change success based on the returned value of the model 
    echo "<script> 
     alert('Success'); 
     window.location.href='".base_url('general/index')."'; 
     </script>"; 
} 
0

はのparamとして、いくつかの値を渡して試してみて、リダイレクトされたページであることを確認することで、成功メッセージを与える正しい応答を取得できません/インデックスファイル

if(isset($_GET['status']) && $_GET['status'] == "success"){ 
     echo "Successfull Message"; 
} 
0

あなたはリダイレクトせずgeneral_formタスクを実行するためにPHPにデータを送信するフォームのためのAjax機能を使用することができます。 PHPが正常にDBにレコードを挿入し、Javascriptを、その後(警告トリガしている場合にtrueを返します)、またはプロンプト()とwindows.location = "あなたのリダイレクトリンク" あなたはdata.seeを渡すflashdataを使用して

関連する問題