-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);

}
?>

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

If you want to make your PHP code look like HTML, you can do this with your .htaccess - See stackoverflow.com/a/5990276/952608

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.