4

I am trying to submit form and get that data in same page when i used the_permalink i am getting page not found.

I used this code:

<?php

/*
    Template Name:testing
*/

if(isset($_POST["name"]))
{   
    echo $_POST["name"];
}

?>

<form action="<?php the_permalink(); ?>" method="POST">
    <input type="text" name="name"  id="name">
    <input type="submit" value="submit">
</form>
3

Do not use any action in form. If you keep empty action of form then data will submit on same page

if(isset($_POST["name"]))
{


    echo $_POST["name"];
}


<form action="" method="POST">
<input type="text" name="names"  id="names">
<input type="submit" value="submit" name="submit_btn">
</form>
| improve this answer | |
  • its saying Oops! That page can’t be found. – madu Aug 3 '15 at 6:15
  • Please check my update answer – Yatendra Aug 3 '15 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.