2015-01-28 1 views
-1

내 신청서 다운로드에 문제가 있습니다. 내 문제는 양식이 제출되었습니다. 내 자바 스크립트 코드가 양식을 다른 페이지에 제출하지 않고 있습니다. 페이지 이름은 app_print.php입니다. 구현했습니다. php.once의 js 코드는 모든 것이 정확합니다. app_print.php는 섹션을 다운로드하러갑니다. 저는 웹 서버에서 호스팅했습니다. 여기 링크가 있습니다. application.php내 신청서 양식에 문제가 있음

<form action="" method="post" name="application"> 
<table width="100%" border="0" cellspacing="0" cellpadding="5"> 
    <tr> 
     <td colspan="3"> 
      <?php 
      if(isset($_POST['application'])) 
      { 
       unset($_POST['application']); 
       if(isset($rep)) 
       { 
        if($rep=='sus') 
        { 
         ?> 
         <div class="sus cl"><img class="pa" src="controller/image/btn/tick_circle.png"/><?php echo $msg;?><a style="margin:0px 0px 0px 0px;" href="javascript:void(0);"><img id="close" src="controller/image/btn/cross_grey_small.png"/></a></div> 
         <?php 
        } 
        else if($rep=='fld') 
        { 
         ?> 
         <div class="error cl"><img class="pa" src="controller/image/btn/cross_circle.png"/><?php echo $msg;?><a href="javascript:void(0);"><img id="close" src="controller/image/btn/cross_grey_small.png"/></a></div> 
         <?php 
        } 
        else if($rep=='atn') 
        { 
         ?> 
         <div class="atn cl"><img class="pa" src="controller/image/btn/exclamation.png"/><?php echo $msg;?><a href="javascript:void(0);"><img id="close" src="controller/image/btn/cross_grey_small.png"/></a></div> 
         <?php 
        } 
       } 
      } 
      ?> 
      </td> 
    </tr> 
    <tr> 
     <th class="lft_col" colspan="3" style="color:#DB0009">APPLICATION FORM</th> 
    </tr> 
    <tr> 
     <td class="red">1.</td> 
     <th class="lft_col"><label>Name of the child<span class="red">*</span><br/><span style="font-size:11px;">(In Block letter)</span></label></th> 
     <td><input class="text" type="text" name="name" placeholder="Enter your Name" required value=""/></td> 
    </tr> 
    <tr> 
     <td class="red">2.</td> 
     <th class="lft_col"><label>Sex</label><span class="red">*</span></th> 
     <td> 
      <select class="select_2" name="sex" required> 
      <option value="">---Select---</option> 
      <option value="Male">Male</option> 
      <option value="Female">Female</option> 
      <option value="Other">Other</option> 
      </select> 
     </td> 
    </tr> 
    <tr> 
     <td class="red">3.</td> 
     <th class="lft_col"><label>Name of Parents<span class="red">*</span></label></th> 
     <td> 
      <table style="text-align:left;" width="100%" border="0" cellspacing="0" cellpadding="0"> 
       <tr> 
        <td class="red">i.</td> 
        <th class="lft_col">Father Name</th> 
        <td><input class="text" type="text" name="father" placeholder="Your Father/Guardian Name" required value=""/></td> 
       </tr> 
       <tr> 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
       </tr> 
       <tr> 
        <td class="red">ii.</td> 
        <th class="lft_col">Mother Name</th> 
        <td><input class="text" type="text" name="mother" placeholder="Your Mother Name" required value=""/></td> 
       </tr> 
      </table> 
     </td> 
    </tr> 
    <tr> 
     <td class="red">4.</td> 
     <th class="lft_col"><label>Address for <br/>communication<span class="red">*</span><label></th> 
     <td><textarea class="text" rows="10" placeholder="Your Communication Address." required name="address"></textarea></td> 
    </tr> 
    <tr> 
     <td class="red">5.</td> 
     <th class="lft_col">Contact No<span class="red">*</span></th> 
     <td><input class="text" type="text" name="mobile" placeholder="Mobile:+91 999999999" required value=""/></td> 
    </tr> 
    <tr> 
     <td class="red">6.</td> 
     <th class="lft_col"><label>Occupation of <br/>Parents with details<span class="red">*</span></label></th> 
     <td> 
      <table style="text-align:left;" width="100%" border="0" cellspacing="0" cellpadding="0"> 
       <tr> 
        <td class="red">i.</td> 
        <th class="lft_col"><label>Father Occupation</label></th> 
        <td><input class="text" type="text" name="father_occ" placeholder="Your Father/Guardian Occupation details" required value=""/></td> 
       </tr> 
       <tr> 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
       </tr> 
       <tr> 
        <td class="red">ii.</td> 
        <th class="lft_col"><label>Mother Occupation</label></th> 
        <td><input class="text" type="text" name="mother_occ" placeholder="Your Mother Occupation details" required value=""/></td> 
       </tr> 
      </table> 
     </td> 
    </tr> 
    <tr> 
     <td class="red">7.</td> 
     <th class="lft_col"><label>Date of Birth<span class="red">*</span><br/><span style="font-size:11px;">(as per Birth certificate)</span></label></th> 
     <td><input class="text" type="date" name="dob" placeholder="Your Date of Birth" required value=""/></td> 
    </tr> 
    <tr> 
     <td class="red">8.</td> 
     <th class="lft_col"><label>No of Year &amp; Months that will <br/>be Completed as on June 1st<span class="red">*</span></label></th> 
     <td><input class="text" type="text" name="age" placeholder="Your Age (YYYY/MM/DD)" required value=""/></td> 
    </tr> 
    <tr> 
     <td class="red">9.</td> 
     <th class="lft_col"><label>Religion &amp; Caste<span class="red">*</span><br/><span style="font-size:11px;">for Statistical purpose only</span></label></th> 
     <td><input class="text" type="text" name="religion" placeholder="Your Religion &amp; Caste" required value=""/></td> 
    </tr> 
    <tr> 
     <td colspan="2">&nbsp;</td> 
     <td class="lft_col"> 
     <input class="btn" type="submit" name="application" value="Submit"/> 
     <input class="btn" onClick="javascript:window.location='application.php'" type="button" name="Cancel" value="Cancel"/> 
     </td> 
    </tr> 
</table> 
</form> 

application.php

if(isset($_POST['application'])) 
{ 
    $name=$_POST['name']; 
    $sex=$_POST['sex']; 
    $father=$_POST['father']; 
    $mother=$_POST['mother']; 
    $address=$_POST['address']; 
    $mobile=$_POST['mobile']; 
    $father_occ=$_POST['father_occ']; 
    $mother_occ=$_POST['mother_occ']; 
    $dob=$_POST['dob']; 
    $age=$_POST['age']; 
    $religion=$_POST['religion']; 
    date_default_timezone_set('Asia/Kolkata'); 
    $cur_date = date('m/d/Y h:i:s a', time()); 
    if($name!=''&&$sex!=''&&$father!=''&&$mother!=''&&$address!=''&&$mobile!=''&&$father_occ!=''&&$mother_occ!=''&&$dob!=''&&$age!=''&&$religion!='') 
    { 
     $con_qry=mysql_query("insert into application (name,sex,father,mother,address,mobile,father_occ,mother_occ,dob,age,religion,cur_date) values('".$name."','".$sex."','".$father."','".$mother."','".$address."','".$mobile."','".$father_occ."','".$mother_occ."','".$dob."','".$age."','".$religion."','".$cur_date."')"); 
     if($con_qry) 
     { 
      $rep="sus"; 
      $msg='Your application is downloaded, you can print the application from your download path.'; 
      echo "<script type='text/javascript'>var url='app_print.php?id=$cur_date&c_name=$name';window.open(url)</script>"; 
     } 
     else 
     { 
      $rep="fld"; 
      $msg='Registeration Faild.'; 
     } 
    } 
} 
?> 

내 app_print.php :

if((isset($_GET['id']))&&(isset($_GET['c_name']))) 
{ 
    $print=mysql_query("select * from application where name='".$_GET['c_name']."' and cur_date='".$_GET['id']."'"); 
    $p_r=mysql_num_rows($print); 
    if($p_r>0) 
    { 
     $print_val=mysql_fetch_array($print); 
     $aid=$print_val['aid']; 
     $name=$print_val['name']; 
     $sex=$print_val['sex']; 
     $father=$print_val['father']; 
     $mother=$print_val['mother']; 
     $address=$print_val['address']; 
     $mobile=$print_val['mobile']; 
     $father_occ=$print_val['father_occ']; 
     $mother_occ=$print_val['mother_occ']; 
     $dob=$print_val['dob']; 
     $age=$print_val['age']; 
     $religion=$print_val['religion']; 
     $cur_date =$print_val['cur_date']; 
     header("Content-Type: application/download"); 
     header("Content-Type: application/msword"); 
     header('content-Disposition: attachment; filename='.$name.' Application'.'.doc'); 
    } 
} 
?> 
<!doctype html> 

    <html> 
    <head> 
    <meta charset="utf-8"> 
    <title>LISIEUX - APPLICATION FORM</title> 
    </head> 
    <body> 
     <form action="" method="post" name="app_print"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="5"> 
       <tr> 
       <td colspan="3" style="text-align:center;"><label><b style="font-size:29px;">Lisieux CMI Public School</b></label><br/><label>(CBSE Syllabus)</label><br/><label>Lisieux Road,Saravanampatti,Viswasapuram,Coimbatore - 641035.</label></td> 
       </tr> 
       <tr> 
       <td>&nbsp;</td> 
       <td>&nbsp;</td> 
       <td>&nbsp;</td> 
       </tr> 
       <tr> 
       <td style="border-top:1px solid #000000;">&nbsp;</td> 
       <td style="border-top:1px solid #000000;">&nbsp;</td> 
       <td style="border-top:1px solid #000000;">&nbsp;</td> 
       </tr> 
       <tr> 
       <th colspan="3" style="text-align:center;">REGISTRATION FORM</th> 
       </tr> 
       <tr> 
       <td>&nbsp;</td> 
       <td>&nbsp;</td> 
       <td style="text-align:right;"><label>Reg.No.&nbsp;:&nbsp;<?php if(isset($aid)){echo $aid;}?></label></td> 
       </tr> 
       <tr> 
       <td>1.</td> 
       <th><label>Name of the child<br/><span style="font-size:16px;">(In Block letter)</span></label></th> 
       <td><label><?php if(isset($name)){echo $name;}?></label></td> 
       </tr> 
       <tr> 
       <td>2.</td> 
       <th><label>Sex</label></th> 
       <td><label><?php if(isset($sex)){echo $sex;}?></label></td> 
       </tr> 
       <tr> 
       <td>3.</td> 
       <th><label>Name of Parents</label></th> 
       <td> 
        <table style="text-align:left;" width="100%" border="0" cellspacing="0" cellpadding="0"> 
         <tr> 
         <td>i.</td> 
         <th><label>Father&nbsp;&nbsp;:&nbsp;</label></th> 
         <td><label><?php if(isset($father)){echo $father;}?></label></td> 
         </tr> 
         <tr> 
         <td>ii.</td> 
         <th><label>Mother&nbsp;:&nbsp;</label></th> 
         <td><label><?php if(isset($mother)){echo $mother;}?></label></td> 
         </tr> 
        </table> 
       </td> 
       </tr> 
       <tr> 
       <td>4.</td> 
       <th><label>Address for <br/>communication</label></th> 
       <td><label><?php if(isset($address)){echo $address;}?></label></td> 
       </tr> 
       <tr> 
       <td>5.</td> 
       <th>Contact No</th> 
       <td><label><?php if(isset($mobile)){echo $mobile;}?></label></td> 
       </tr> 
       <tr> 
       <td>6.</td> 
       <th><label>Occupation of <br/>Parents with details</label></th> 
       <td> 
        <table style="text-align:left;" width="100%" border="0" cellspacing="0" cellpadding="0"> 
         <tr> 
         <td>i.</td> 
         <th><label>Father&nbsp;&nbsp;:&nbsp;</label></th> 
         <td><label><?php if(isset($father_occ)){echo $father_occ;}?></label></td> 
         </tr> 
         <tr> 
         <td>ii.</td> 
         <th><label>Mother&nbsp;:&nbsp;</label></th> 
         <td><label><?php if(isset($mother_occ)){echo $mother_occ;}?></label></td> 
         </tr> 
        </table> 
       </td> 
       </tr> 
       <tr> 
       <td>7.</td> 
       <th><label>Date of Birth<br/><span style="font-size:16px;">(as per Birth certificate)</span></label></th> 
       <td><label><?php if(isset($dob)){echo $dob;}?></label></td> 
       </tr> 
       <tr> 
       <td>8.</td> 
       <th><label>No of Year &amp; Months that will be<br/>Completed as on June 1st</label></th> 
       <td><label><?php if(isset($age)){echo $age;}?></label></td> 
       </tr> 
       <tr> 
       <td>9.</td> 
       <th><label>Religion &amp; Caste<br/><span style="font-size:16px;">for Statistical purpose only</span></label></th> 
       <td><label><?php if(isset($religion)){echo $religion;}?></label></td> 
       </tr> 
       <tr> 
       <td colspan="3"> 
        <table width="100%" border="0" cellspacing="0" cellpadding="5"> 
         <tr> 
         <td>&nbsp;</td> 
         <td>&nbsp;</td> 
         </tr> 
         <tr> 
         <td>&nbsp;</td> 
         <td>&nbsp;</td> 
         </tr> 
         <tr> 
         <td>&nbsp;</td> 
         <td>&nbsp;</td> 
         </tr> 
         <tr> 
         <td>&nbsp;</td> 
         <td>&nbsp;</td> 
         </tr> 
         <tr> 
         <td><label>Date&nbsp;:&nbsp;<?php if(isset($cur_date)){echo $cur_date;}?></label></td> 
         <td style="text-align:right;">Signature of Parent/Guardian</td> 
         </tr> 
        </table> 
       </td> 
       </tr> 
      </table> 
     </form> 

답변

0

window.open이하는 (여기
http://lisieuxcbsekovai.com/application.php 내 코드입니다 놀람) 새로운 브라우저를여십시오 w indow. 브라우저에 팝업 차단기가 활성화되어 있지 않습니까? 그렇지 않으면 팝업을 놓칠 수 있습니다. 모든 주요 브라우저에서 F12 디버깅 도구로 Javascript를 디버깅 할 수 있습니다. 중단 점을 window.open 줄에 설정하고 줄이 호출되는지 확인하십시오. 일부 팝업 차단기도 F12를 통해 사용할 수있는 콘솔에 로그온합니다.

+0

예 이제는 제대로 작동하고 있습니다. 중단 점을 window.open 함수로 설정하고 있습니다. php.is에서 JavaScript를 사용하고 있습니까? 채워진 양식에서 정보를 검색하려면 db.because에서 이름과 현재 날짜를 사용했습니다. 한 번에 하나씩 applicaton.so를 채울 수 있습니다. 따라서 내 응용 프로그램이 완벽하게 작동해야합니다. 나는 당신에게 질문을했습니다. 내 app_print를 확인하십시오. PHP 파일 및 응답을 제공합니다. –

+0

제 질문은 받았습니까? –

+0

PHP에서 자바 스크립트를 "사용"하고 있지 않습니다. 방금 정의한 HTML 조각입니다. 자바 스크립트 코드는 클라이언트 브라우저에서 실행됩니다. 응용 프로그램이 작동하는 경우 원하는 작업에 따라 다릅니다. 직접 테스트 해주세요. –

0

window.open() 불행하게도 페이지로드 중에 사용되는 경우 불필요한 팝업이 '원치 않는'팝업으로 차단되는 경우가 있습니다. window.open() 문을 호출하는 다른 방법을 사용하십시오. 같은 뭔가

echo "<script type='text/javascript'>var url='app_print.php?id=$cur_date&c_name=$name';window.open(url)</script>"; 

: 따라서

echo "<script type='text/javascript'>window.onload=function() { window.location='/app_print.php?id=$cur_date&c_name=$name' }; </script>"; 

window.open()를 사용하지 않는 당신이 시도하는 (그리고 측 팝업 차단을 스테핑) 무엇을 수행하는 다른 방법은 app_print.php에 문을 변경을 고려하는 것입니다 조금도.