dongxu2398
dongxu2398
2017-06-19 04:51
浏览 60
已采纳

在将表单数据提交到下一页时,自定义php模板无法在wordpress上工作

this is from i have using in custom template

 <form class="register" id="hh" method="POST" action="http://www.website.com/online-registration">
      <input type="text" id="name" name="name" value="" class="register-input" placeholder="Name"/> 
      <input type="email"  id="email" name="email" class="register-input" placeholder="Email address" required>
      <input type="password" id="password" name="password" class="register-input" placeholder="Password">
      <input type="text" id="mobile" name="mobile" value="" placeholder="mobile" class="register-input" required />
      <input type="text" id="city" name="city" value="" placeholder="Current City" class="register-input" />
      <input type="text" id="qualification" name="qualification" value="" placeholder="Qualification Details" class="register-input" />
      <select id="subject" name="subject"  class="register-input"> 
      <option value=""> Please Select Type </option> 
      <option> Seeker </option>
      <option> Employer </option>
      <textarea cols="40" rows="2" placeholder="Message" class="register-input" id="message" name="message"></textarea> 
      <input type="submit" value="Send" name="reg" id="reg" class="register-button">
      </form>

facing problem when data goes to next page

<?php /* Template Name: applyregistration */ ?>
<?php get_header();   include('conn.php');    ?>

Here i get error -Sorry, No Posts Found

<?php
 include 'conn.php';

   if ($_SERVER['REQUEST_METHOD'] == 'POST')

{
}

图片转代码服务由CSDN问答提供 功能建议

这是我在自定义模板中使用

 &lt; form class =“register”id =“hh”method =“POST”action =“http://www.website.com/online-registration”&gt; 
&lt; input type =  “text”id =“name”name =“name”value =“”class =“register-input”placeholder =“Name”/&gt;  
&lt; input type =“email”id =“email”name =“email”class =“register-input”placeholder =“Email address”required&gt; 
&lt; input type =“password”id =“password”  name =“password”class =“register-input”placeholder =“Password”&gt; 
&lt; input type =“text”id =“mobile”name =“mobile”value =“”placeholder =“mobile”class =  “register-input”required /&gt; 
&lt; input type =“text”id =“city”name =“city”value =“”placeholder =“Current City”class =“register-input”/&gt; \  n&lt; input type =“text”id =“qualification”name =“qualification”value =“”placeholder =“Qualification Details”class =“register-input”/&gt; 
&lt; select id =“subject”name  =“subject”class =“register-input”&gt;  
&lt; option value =“”&gt; 请选择类型&lt; / option&gt;  
&lt;选项&gt; 搜索者&lt; /选项&gt; 
&lt;选项&gt; 雇主&lt; / option&gt; 
&lt; textarea cols =“40”rows =“2”placeholder =“Message”class =“register-input”id =“message”name =“message”&gt;&lt; / textarea&gt;  
&lt; input type =“submit”value =“发送”name =“reg”id =“reg”class =“register-button”&gt; 
&lt; / form&gt; 
   
 
 

数据进入下一页时遇到问题

 &lt;?php / *模板名称:applyregistration * /?  &gt; 
&lt;?php get_header(); 包括( 'conn.php');  ?&gt; 
   
 
 

这里我收到错误-Sorry,找不到帖子 < pre> &lt;?php include'conn.php'; if if($ _SERVER ['REQUEST_METHOD'] =='POST') { }

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • douzhi7451
    douzhi7451 2017-06-19 04:56
    已采纳

    Close Select Tag select tag.

    <form class="register" id="hh" method="post" action="formaction.php">
    
     <input type="text" id="name" name="name" value="" class="register-input" placeholder="Name"/> 
    
      <input type="email"  id="email" name="email" class="register-input" placeholder="Email address" required>
    
      <input type="password" id="password" name="password" class="register-input" placeholder="Password">
    
      <input type="text" id="mobile" name="mobile" value="" placeholder="mobile" class="register-input" required />
    
    <input type="text" id="city" name="city" value="" placeholder="Current City" class="register-input" />
    
     <input type="text" id="qualification" name="qualification" value="" placeholder="Qualification Details" class="register-input" />
    
      <select id="subject" name="subject"  class="register-input"> 
          <option value=""> Please Select Type </option> 
          <option> Seeker </option>
          <option> Employer </option>
      </select>
    
       <textarea cols="40" rows="2" placeholder="Message" class="register-input" id="message" name="message"></textarea> 
    
     <input type="submit" value="Send" name="reg" id="reg" class="register-button">
    

    点赞 评论
  • dtwncxs3547
    dtwncxs3547 2017-06-19 06:32

    It is the issue of name of variables that i have using in form.. just change the attributes names.. Example - name to name1, email to email1..etc etc..

    Problem Solved

    点赞 评论
  • dpq59734
    dpq59734 2017-06-19 06:47

    this link is very useful to create customized form in WordPress https://www.inkthemes.com/how-you-can-easily-create-customized-form-in-wordpress/

    点赞 评论

相关推荐