-1

I'm trying to call class method as usual. The problem is that when -> is entered to call method by object at following line

$Error = $obj->set($Name,$Fname,$Gender,$Email,$Password);

after -> same code prints on page.

I mean perhaps compiler consider > in object->set() as closing tag of PHP. My page is saved as html extension and all other HTML code work right, but method is not calling and text after -> printing as it is on page.

Following is my code

<?php
include 'Validation.php';
$obj= new formvalidate;
if(isset($_POST['signup'])) 
{


    $Name=$_POST['name'];
    $Fname=$_POST['fname'];
    $Gender=$_POST['gender'];
    $Email=$_POST['email'];
    $Password=$_POST['password'];
    $Error = $obj->set($Name,$Fname,$Gender,$Email,$Password);

}
?>
halfer
  • 19,824
  • 17
  • 99
  • 186
Ayeshay
  • 1
  • 4

1 Answers1

3

Most web server won't run php in files that don't have .php extension. So .html files are treated as plain html files. Content between < and > are treated as html tag.

Change your extension to .php so, web server will parse php code.

Bostjan
  • 774
  • 6
  • 11
  • If you want to make your PHP code look like HTML, you can do this with your `.htaccess` - See http://stackoverflow.com/a/5990276/952608 – Moe Jan 20 '17 at 14:10