Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress plugin form submitting
    text
    copied!<p>I have created a plugin for saving the reply me details. But whenever I submit the form using the plugin, it shows an error and it is redirected to some other page that shows 'Not Found Apologies, but the page you requested could not be found. Perhaps searching will help." message. Please check my code</p> <pre><code>&lt;?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-&gt;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-&gt;query($structure); } add_shortcode('register', 'process_post'); function process_post(){ //include("reg_form.php"); ?&gt; &lt;form id="frmRegistration" name="frmRegistration" action="&lt;?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?&gt;" method="POST"&gt; &lt;table style="align:center; width:500px; margin: 0 0 0 0;"&gt; &lt;tr&gt; &lt;td&gt;Name &lt;/td&gt; &lt;td&gt;&lt;input type="text" name="name" id="name" maxlength="50" &gt;&lt;b&gt;&lt;font color="red"&gt;*&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Place &lt;/td&gt; &lt;td&gt;&lt;input type="text" name="place" id="place" maxlength="50" &gt;&lt;b&gt;&lt;font color="red"&gt;*&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Email &lt;/td&gt; &lt;td&gt;&lt;input type="text" name="email" id="email" maxlength="50" &gt;&lt;b&gt;&lt;font color="red"&gt;*&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Mobile No&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="mobile_no" id="mobile_no" maxlength="50"&gt;&lt;b&gt;&lt;font color="red"&gt;*&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;About Yourself&lt;/td&gt; &lt;td&gt;&lt;textarea rows="4" cols="50" name="about" id="about" &gt; &lt;/textarea&gt; &lt;b&gt;&lt;font color="red"&gt;*&lt;/font&gt;&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input type="submit" name="btnSubmit" id="btnSubmit" value="Submit Details" style="color:blue;"&gt;&lt;/td&gt; &lt;td align="right"&gt;&lt;b&gt;&lt;font color="red"&gt;*&lt;/font&gt;&lt;/b&gt; fileds are mandatory&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;?PHP global $wpdb; $table = $wpdb-&gt;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-&gt;query("INSERT INTO $table(name, place,email,mobno,about_me,date_apply) VALUES('$name', '$place',' $email', '$mobile_no', '$about_yourself',now())"); } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload