-1

在此处输入图像描述 这是我为注册表单创建的 html 页面,是否可以将其插入 wordpress CMS 并在 wordpress 数据库中创建一个新表,以便我可以将我的值插入到新表中。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="regform.css">
<script type="text/javascript" src="script/jquery-1.7.1.min.js"></script> 
<script type="text/javascript" src="script/disphid.js"></script>

<title>Untitled Document</title>
</head>
<body >
    <div class="maindiv" align="center">

        <div class="submaindiv" >

            <div id="custdet" class="custdet" >
                <p class="txtclass">Customer Details</p>
             </div>
            <div id="custnamefield" class="custdet">
               <div id="custname" class="custdetailslft">
                    Customer Name:
               </div>
               <div id="custnametext" class="custdetailsright">
                    <input type="text" name="custname" class="txtfld" maxlength="200" id="custname1"  >
               </div>
            </div>
              <div class="customertype" >
                 <div class="custtypeleft" >
                    Customer Type:               
                 </div>
                   <div class="customertyperight" >
                    <select class="combo" id="comb"  onchange="othcusdisp()" onchange="customer()">
                     <option value="select01">-Select-</option>
                     <option value="select1">1</option>
                     <option value="select2">2</option>
                     <option value="select3" >Other</option>
                    </select> 
                   </div>
               </div>
                  <div class="othcomptype" id="othercompid" >
                      <div class="othcompleft">
                        Other Company:
                      </div>
                      <div class="othcompright">
                        <input type="text" class="txtfld" maxlength="200" name="othercompany" placeholder="Enter Company" id="othercomp" >
                       </div>
                  </div>
               <div class="logidiv">
                 <p class="txtclass">Login Details </p>
               </div>

               <div class="logindetails">
                    <div class="logindetailsleft">
                      Username:
                    </div>  
                     <div class="logindetailsright">
                        <input type="text" name="username" maxlength="200" class="txtfld" id="username">
                      </div>
               </div>
               <div class="passworddiv">
                    <div class="passwordleft">
                       Password:
                    </div>  
                    <div class="passwordright">
                     <input type="password" name="password" maxlength="10" class="txtfld" placeholder="Password" id="pass" >
                    </div>
              </div>  
               <div class="repassword">
                    <div class="repasswordleft">
                       Confirm Password:
                    </div>  
                    <div class="repasswordright">
                     <input  type="password" name="confrmpass" maxlength="10" class="txtfld" id="confirmpass"  >
                    </div>
               </div>
               <div class="custaddressdiv">
                  <p class="txtclass">Customer Address</p>
               </div> 
               <div class="custaddress"> 
                   <div class="custaddressleft">
                      Address:
                    </div>
                    <div class="custaddressright">
                       <input  type="text" name="address" maxlength="200" class="txtfld" id="custaddress1" >
                    </div>
               </div>
               <div class="placediv"> 
                   <div class="placedivleft">
                      Place:
                    </div>
                    <div class="placedivright">
                       <select class="combo " id="place" onchange="othplace()">
                         <option value="select">-Select-</option>
                         <option value="select1">Aluva</option>
                         <option value="select2">Athani</option>
                         <option value="select3">Other</option>
                        </select> 
                     </div>
               </div> 
               <div class="placediv" id="placedivright"> 
                   <div class="placedivleft">

                    </div>
                    <div class="placedivright" >
                       <input  type="text" name="district   " maxlength="200" class="txtfld" placeholder="Enter Place">
                     </div>

               </div> 
               <div class="placediv"> 
                   <div class="placedivleft">
                      District:
                    </div>
                    <div class="placedivright">
                        <input  type="text" name="district  " maxlength="200" class="txtfld" id="district">
                     </div>
               </div> 
               <div class="placediv"> 
                   <div class="placedivleft">
                      State:
                    </div>
                    <div class="placedivright">
                         <input  type="text" name="state" maxlength="200" class="txtfld" id="state">
                     </div>
               </div> 
               <div class="placediv"> 
                   <div class="placedivleft">
                      Nation:
                    </div>
                    <div class="placedivright">
                         <select class="combo " id="nation">
                       <option value="select">-Select-</option>
                       <option value="select1">India</option>
                       <option value="select2">USA</option>
                        <option value="select3">Canada</option>
                         </select> 
                     </div>
               </div>
                 <div class="custdet">
                   <p class="txtclass">Contact Details
                 </div>

                 <div class="passworddiv">
                    <div class="passwordleft">
                       Contact Number:
                    </div>  
                    <div class="passwordright">
                     <input type="text" name="contactnum" maxlength="11" class="txtfld" id="phonenum1" >
                    </div>
              </div>  
               <div class="repassword">
                    <div class="repasswordleft">
                       Email Id:
                    </div>  
                    <div class="repasswordright">
                     <input  type="text" name="email" maxlength="200" class="txtfld" id="email">
                    </div>
               </div> 
               <div class="repassword">
                    <div class="repasswordleft">
                       Web Address:
                    </div>  
                    <div class="repasswordright">
                     <input  type="text" name="webid" maxlength="200" class="txtfld"  id="webid">
                    </div>
               </div>
                <div class="save">
                  <div class="savebutton">
                  <input  type="button" name="button"   value="Save" onclick="regval()"   >
                  </div>
                </div>      

            </div>   

      </div>
    </body>
</html>    

这是我创建的注册表单的 html 代码。我需要将其插入 word press CMS。我还需要在 word press 数据库中创建一个新表,以便我可以将所有字段插入数据库。

4

1 回答 1

0

您需要有一个动态的 .php 文件并从 WordPress 加载 wp-load.php 才能访问其所有功能。

require_once( '/path-to-wp/wp-load.php' );

显然,调整 path-to-wp 部分。之后,只需使用 WordPress 类和函数http://codex.wordpress.org/Class_Reference/wpdb

于 2013-10-03T21:40:43.560 回答