Why Insert PHP Code Snippet does not work in WordPress

this is a very simple mistake I will explain this follow me and read this blog here two examples here first work PHP form and second not work PHP

Example 2:-

We saw in the first example how to add a PHP form. Now we will see in the second example how Echo works.


output:-


Why Insert PHP Code Snippet does not work in WordPress

We add internal input when adding a PHP form
then input under type=”submit” and name=”submit” is not work

Work


<form action="" method="">
<input type="text" name="firstname">
<input type="submit" name="clickhere">
</form>

</php

if(isset($_POST['clickhere']))
{
  $firstname = $_POST['firstname'];

  echo $firstname;
}

?>

Not Work

<form action="" method="">
<input type="text" name="name">
<input type="submit" name="submit">
</form>

</php

if(isset($_POST['submit']))
{
  $name = $_POST['name'];

  echo $name ;
}

?>

Leave a Comment

Your email address will not be published. Required fields are marked *