用于文件类型HTML表单的ajax-contact-form

时间:2013-12-20 16:52:15

标签: javascript php ajax forms

我有一个这样的表格:

<form id ="ajax-contact-form" action="upload.php" method = "post">

                <div class="col1">

                  <div class="clear"></div>
                  <br><br>
                  <INPUT type="text" name="Name" value="Full name:" onBlur="if(this.value=='') this.value='Full name:'" 
                            onFocus="if(this.value =='Full name:' ) this.value=''">
                  <div class="clear"></div>

                  <INPUT type="text" name="Email" value="Your email:" onBlur="if(this.value=='') this.value='Your email:'" 
                            onFocus="if(this.value =='Your email:' ) this.value=''"><div class="clear"></div>

                  <INPUT type="text" name="University" value="University, College or Institute:" onBlur="if(this.value=='') this.value='University, College or Institute:'" 
                            onFocus="if(this.value =='University, College or Institute:' ) this.value=''">
                  <div class="clear"></div></div>

                  <div class="col1 pad_left5"><br>
                  <h4>Please write about your academic research experiences:</h4>
                  <TEXTAREA NAME="Content" onBlur="if(this.value=='') this.value=''" 
                          onFocus="if(this.value =='' ) this.value=''"></TEXTAREA>
                  <div class="clear"></div></div>
                  <div class="clear"></div>


                  <br><h4>Upload your photo (200 x 200):</h4><br>
                  <INPUT type = "file" name="Picture" id = "picture" lang="en">
                  <div class="clear"></div><br>

                  <h4>Please upload your academic publications under one folder as a compressed file:</h4><br>
                  <INPUT type = "file" name="Publications" id = "Publication" lang="en">
                  <div class="clear"></div><br>

                  <div class="box">
                  <div class="services1">
                  <h4>GPA</h4><br>
                  <INPUT class="capthca" type="text" name="GPA" value="GPA:" onBlur="if(this.value=='') this.value='GPA:'" 
                            onFocus="if(this.value =='GPA:' ) this.value=''">

                  <div class="clear"></div><br>

                  <h4>IELTS</h4><br>
                  <INPUT class="capthca" type="text" name="IELTS" value="IELTS Score:" onBlur="if(this.value=='') this.value='IELTS Score:'" 
                            onFocus="if(this.value =='IELTS Score:' ) this.value=''">
                  <div class="clear"></div>
                  </div>

                  <div class="services1">
                  <h4>TOEFL</h4><br>
                  <INPUT class="capthca" type="text" name="PBT" value="PBT:" onBlur="if(this.value=='') this.value='PBT:'" 
                            onFocus="if(this.value =='PBT:' ) this.value=''"> <div class="clear"></div>

                  <INPUT class="capthca" type="text" name="CBT" value="CBT:" onBlur="if(this.value=='') this.value='CBT:'" 
                            onFocus="if(this.value =='CBT:' ) this.value=''"> <div class="clear"></div>

                  <INPUT class="capthca" type="text" name="IBT" value="IBT:" onBlur="if(this.value=='') this.value='IBT:'" 
                            onFocus="if(this.value =='IBT:' ) this.value=''"> <div class="clear"></div>


                  <div class="clear"></div> 
                  </div>

                  <div class="services1 last">
                  <h4>ALES</h4><br>
                  <INPUT class="capthca" type="text" name="VERBAL" value="Verbal Score:" onBlur="if(this.value=='') this.value='Verbal Score:'" 
                            onFocus="if(this.value =='Verbal Score:' ) this.value=''"> <div class="clear"></div>

                  <INPUT class="capthca" type="text" name="MATH" value="Math Score:" onBlur="if(this.value=='') this.value='Math Score:'" 
                            onFocus="if(this.value =='Math Score:' ) this.value=''"> <div class="clear"></div>

                  <INPUT class="capthca" type="text" name="EQUALWEIGHT" value="Equal Weight Score:" onBlur="if(this.value=='') this.value='Equal Weight Score:'" 
                            onFocus="if(this.value =='Equal Weight Score:' ) this.value=''"> <div class="clear"></div>
                  </div>          
                  <div class="clear"></div> 
                  </div>     
                  <div class="clear"></div>
                  <INPUT class="submit" type="submit" name="submit" value="submit">
                  <div class="clear"></div>  


                  <?php
                  $Name = $_POST["Name"];
                  $University = $_POST["University"];
                  $Academic_Experience = $_POST["Content"];
                  $Photo = $_POST["Picture"];
                  $Publications = $_POST["Publications"];
                  $GPA = (float)$_POST["GPA"];
                  $VERBAL = (float)$_POST["VERBAL"];
                  $MATH = (float)$_POST["MATH"];
                  $EQUALWEIGHT = (float)$_POST["EQUALWEIGHT"];
                  $PBT = (float)$_POST["PBT"];
                  $CBT = (float)$_POST["CBT"];
                  $IBT = (float)$_POST["IBT"];
                  $IELTS = (float)$_POST["IELTS"];
                  ?>
                  </form>

当我运行此代码时,提交不起作用。但是,当我删除'id =“ajax-contact-form”时,提交有效。但我想以ajax-contact-form的风格设计我的表单。我该如何解决这个问题?可能ajax-contact-form不起作用,因为它涉及文件类型输入。但我真的需要这种类型的输入,并希望设计ajax-contact-from。我在等你的帮忙。谢谢......

0 个答案:

没有答案