2012-05-15 3 views
3

회신 내용을 저장하는 플러그인을 만들었습니다. 그러나 플러그인을 사용하여 양식을 제출할 때마다 오류가 표시되고 '찾을 수 없음'을 표시하는 다른 페이지로 리디렉션됩니다. 죄송하지만 요청한 페이지를 찾을 수 없습니다. 아마도 검색이 도움이 될 것입니다.. 확실히, 일부 고유 한 문자열 전에 다른 이름을 대체 "버그"메시지. 내 코드를 확인하시기 바랍니다Wordpress 플러그인 양식 제출

<?PHP 
/* 
Plugin Name: Register Me 
Plugin URI: http://demo.net 
Description: Plugin is shows a simple Registration form 
Author: Sumod Nair 
Version: 1.0 
Author URI: http://demo.net 
*/ 
add_action('init', 'reg_install'); 
function reg_install() 
{ 
    global $wpdb; 
    $table = $wpdb->prefix."reg_details"; 
    $structure = "CREATE TABLE $table (
     id INT(9) NOT NULL AUTO_INCREMENT, 
     name VARCHAR(80) NOT NULL, 
     place VARCHAR(20) NOT NULL, 
     email VARCHAR(20) NOT NULL, 
     mobno VARCHAR(20) NOT NULL, 
     about_me VARCHAR(500) NOT NULL, 
     date_apply datetime, 
     UNIQUE KEY id (id) 
    );"; 
    $wpdb->query($structure); 
} 

add_shortcode('register', 'process_post'); 

function process_post(){ 
//include("reg_form.php"); 
?> 
<form id="frmRegistration" name="frmRegistration" action="<?php echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']); ?>" method="POST"> 
<table style="align:center; width:500px; margin: 0 0 0 0;"> 
<tr> 
<td>Name </td> 
<td><input type="text" name="name" id="name" maxlength="50" ><b><font color="red">*</font></b></td> 
</tr> 
<tr> 
<td>Place </td> 
<td><input type="text" name="place" id="place" maxlength="50" ><b><font color="red">*</font></b></td> 
</tr> 
<tr> 
<td>Email </td> 
<td><input type="text" name="email" id="email" maxlength="50" ><b><font color="red">*</font></b></td> 
</tr> 
<tr> 
<td>Mobile No</td> 
<td><input type="text" name="mobile_no" id="mobile_no" maxlength="50"><b><font color="red">*</font></b></td> 
</tr> 
<tr> 
<td>About Yourself</td> 
<td><textarea rows="4" cols="50" name="about" id="about" > 

</textarea> <b><font color="red">*</font></b></td> 
</tr> 
<tr> 
<td><input type="submit" name="btnSubmit" id="btnSubmit" value="Submit Details" style="color:blue;"></td> 
<td align="right"><b><font color="red">*</font></b> fileds are mandatory</td></tr> 
</table> 
</form> 

<?PHP 
    global $wpdb; 
    $table = $wpdb->prefix."reg_details"; 
if(isset($_POST['btnSubmit'])) { 
    // process $_POST data here 
    $name = $_POST['name']; 
    $place = $_POST['place']; 
    $email = $_POST['email']; 

    $mobile_no = $_POST['mobile_no']; 
    $about_yourself = $_POST['about']; 
    echo $name." " .$place." " .$email ." " .$mobile_no." " .$about_yourself; 
    $wpdb->query("INSERT INTO $table(name, place,email,mobno,about_me,date_apply) 
     VALUES('$name', '$place',' $email', '$mobile_no', '$about_yourself',now())"); 
} 
} 
?> 
+0

양식의 생성 된 HTML을 보면 ' '로 나오면? – Jhong

+0

양식의 action 속성에 생성 된 값을 확인하고 싶을 것이다. action = " " 양식이 존재하지 않는 페이지에 게시 중임을 나타냅니다. 'action ="# "'" –

+0

을 설정하여 자신에게 게시하도록 작업 속성을 변경할 수도 있습니다. #, 하지만 여전히 동일한 오류 메시지가 나타납니다. "나는 PHP =" "스크립트에서. 이제는"= "하지만 사용하지 않는 액션을 사용하고 있습니다. –

답변

1

다른 뭔가 name="name" 교체, 나는 정확히 같은으로 실행했습니다 " 예 : name="frm-name", name="frm-mobile_no"

관련 문제