Reputation: 1210
Hi i am developing a WordPress plugin.. this is my shortcode.php file.
It shows form correctly. but form submission is not working.. after form submission it shows page not found error.
<?php
//shortcode [my_table id=""]
function custom_table_shortcode($atts)
{
extract(shortcode_atts(array(
'id'=>''
), $atts));
ob_start();
global $wpdb;
if(isset($_POST['insert']))
{
$from="[email protected]";
$check1=$_POST['check1'];
$check2=$_POST['check2'];
$check3=$_POST['check3'];
mail("[email protected]", "Form Submission Notice", $check1 , "From: $from");
print "Your form has been submitted";
}
?>
<form id="twform" action="#" method="post">
<input id="check1" type="checkbox" name="check1" />Print Design
<input id="check2" type="checkbox" name="check2"/>Logo Design
<input id="check3" type="checkbox" name="check3"/>Web Design
<input type="submit" value="Save" name="insert">
</form>
<?php return ob_get_clean();
}
?>
I dont know how to solve that problem.. please any one help me..
Thanks in advance.
Upvotes: 0
Views: 166
Reputation: 2128
Try replacing your action="#" with..
action="<?php $_SERVER['PHP_SELF']; ?>"
I have faced the same issue bofore... let me know this helps you or not...
Upvotes: 1
Reputation: 720
Please try
<form id="twform" action="<?php echo get_permalink(); ?>" method="post">
Upvotes: 1