PHP parse error
getting this PHP error. Any advice? ( ! ) Parse error: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) in C:\wamp64\www\ContractorPHPQ1\get-method.php on line 15 PHP code <?php class Info { public $name; function __construct($name) { $this->name = $name; } function get_name() { return $this->name; } // Check if the form is submitted if ( isset( $_GET['submit'] ) ) { // retrieve the form data by using the element's name attributes value as key $firstname = $_GET['firstname']; $lastname = $_GET['lastname']; // display the results echo '<h3>Form GET Method</h3>'; echo 'Your name is ' . $firstname . ' ' . $lastname; exit; } } $object = new Info("Form Method"); echo $object->get_name(); ?> html code <form action="get-method.php" method="get"> <input type="text" name="firstname" placeholder="First Name" /> <input type="text" name="lastname" placeholder="Last Name" /> <input type="submit" name="submit" /> </form>