2017-07-17 119 views
1

你好,我對WordPress的要求很新,我的要求我已經在wordpress主題中創建了幾個php文件。凡detailsform.php由Wordpress表單未提交

<form method="post" name="details" action="customerdetails.php"> 

這裏點擊提交按鈕的形式具有重定向在PHP customerdetails.php它工作正常,但在WordPress它給404錯誤後(網頁未找到),我保存了所有新的PHP現有主題文件夾中的文件。

請建議我這是在殺我的時間。

+0

你的文件路徑是否正確? – lalithkumar

+0

我把PHP文件放在我的主題文件夾中,它位於htdocs/wp-content/themes/my-theme – Rajaneesh

+0

你目前的文件路徑是什麼? – lalithkumar

回答

0

404錯誤表示操作對於窗體是錯誤的。

<form method="post" name="details" action="customerdetails.php"> 
             ^    ^

糾正行動customerdetails.php

+0

我試過路徑c:\\ xampp \ htdocs \ wp-content \ themes \ my-theme \ customerdetails.php – Rajaneesh

+0

是路徑正確? –

0

問題的確切路徑必須與路徑(在提交表單重定向URL),嘗試用完整的URL。 你可以分享你的表單的URL?

+0

xampp/htdocs/wp-content/themes/my-theme – Rajaneesh

+0

多數民衆贊成在錯誤,它是一個絕妙的道路,它不會工作。使用域名(服務器)的路徑,如http://localhost/wp-content/themes/my-theme/customerdetails.php –

0
// Put your file customerdetails.php in current theme and use following path in action:- 

    <form method="post" name="details" action="<?php echo get_template_directory_uri() ?>/customerdetails.php"> 
0
  1. 編輯你的PHP文件,模板。例如, http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-page-in-wordpress/

<?php 
 
/* 
 
Template Name: Customer Details Page 
 
*/ 
 
get_header(); 
 
?> 
 
// your php file as it is. 
 
<?php get_footer(); ?>

  • 現在創建 「爲CustomerDetails」 新頁面名稱在右側欄中& WP管理員&選擇 「客戶詳細信息頁面」保存。

  • 現在你的表格操作路徑將是如下

  • <form method="post" name="details" action="<?php echo get_site_url(); ?>/customerdetails">

    現在你的形式得到提交&爲CustomerDetails頁面還收到後的數據。