How do we send php page attribute values to a php class method

How do we send php page attribute values to a php class method?. I want to get php attribute values into a php class method. following is the way i tried.

<!DOCTYPE html>

<html>

<head>
  <title>test</title>

</head>

<body>
  <form id="test" method="post" action="testPhp">
    <label>Name</label>
    <input type="text" name="n1" id="name" />
    <input type="submit" value="ADD NAME">
  </form>
</body>

</html>

Now I want to get this name value in method in separate php file

testPhp.php
<?php

class getParam{

public function getFormParm(){
$name = $_POST['name'];
}

}
     
    ?>


Source: oop

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.