我有一个简单的表单,我只想将表单提交到同一页。我试过阅读其他答案,包括action=""
- wordpress说Oops! That page can’t be found.
action="#"
- wordpress说Oops! That page can’t be found.
action="<?php echo($_SERVER["PHP_SELF"]);?>"
- 重定向到/index.php
第页removing action tag
- wordpress说Oops! That page can’t be found.
但什么都不起作用。我现在该怎么办<这是我的代码 <?php
/*
Plugin Name: Contact Form
Plugin URI: http://wpgeeks.net/
Version: 1.0
Author: Adam
Description: A simple contact form for testing
*/
/*Security Note: Consider blocking direct access to your plugin PHP files by adding the following line at the top of each of them, or be sure to refrain from executing sensitive standalone PHP code before calling any WordPress functions.*/
defined( \'ABSPATH\' ) or die( \'No script kiddies please!\' );
//add_action( \'plugins_loaded\', \'functionShowForm\' );
function functionShowForm($atts){
$waq_values = shortcode_atts(array(
\'color\'=>\'white\'
),esc_html($atts));
?>
<form style="color:<?php echo $waq_values[\'color\'];?>;" method="post" action=" ">
Name: <input type="text" name="waq_name" placeholder="First Name">
Email: <input type="email" name="waq_email" placeholder="[email protected]">
Password:<input type="password" name="waq_password">
<input type="submit" name="waq_submit" value="Submit">
</form>
<?php
}//function ends here
function process_wpse_194468(){
if ($_SERVER[\'REQUEST_METHOD\']=="POST" and isset($_POST["waq_submit"])){
$to = sanitize_email($_POST["waq_email"]);
$subject = esc_html($_POST["waq_name"]);
$message = $_POST["waq_password"];
echo "Email " .$to;
wp_mail( $to, $subject, $message );
}
}
//short code
add_shortcode(\'showform\',\'functionShowForm\');
add_action(\'init\',\'process_wpse_194468\');
?>