'Set Form action in wordpress
I am creating form for wordpress website. Currently i am getting value on same page successfully with blank action
.
Now i need to get form value on data.php
page.
Form
<form id="post-container" action="<?php echo home_url( '/' ); ?>data.php" method="POST">
<input name="aa" value="post_id"> ........ </input>
<input name="ab" value="post_id"> ........ </input>
<input type="submit" name="submit" value="submit">
</form>
data.php
<?php
if (isset ( $_POST['aa'] )){
$ID = $_POST['aa'] ;
echo get_post_meta( $ID, 'brand', true );
}
if (isset ( $_POST['ab'] )){
$ID = $_POST['ab'] ;
echo get_post_meta( $ID, 'brand', true );
}
?>
After submit
url = http://localhost/mobile/data.php
which is correct.
but it display index.php which is wrong and also not print any value.
How to submit form to data.php and print value?
Solution 1:[1]
Wordpress have protection from POST, GET requests..
I have some links about it
wordpress-jquery-contact-form-without-a-plugin
create-a-submit-form-in-wordpress
add_query_arg
how-to-submit-a-form-in-wordpress
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Community |