I made a register login system in object-oriented PHP. I need the HTML code to be callable from a PHP method.
Here is the View.php class:
<?php
class View{
public function createLoginUI(){
?>
<html>
<title></title>
<head></head>
<body>
<form>
Email:<input type="text" name="mail">
Pass:<input type="text" name="pass">
<input type="submit" name="login" value="Login"><br>
<a href="?regist" >Regist</a>
</form>
</body>
</html>
<?php
}
public function createRegistUI()
{
?>
<html>
<title></title>
<head></head>
<body>
<form>
Name:<input type="text" name="name">
Email:<input type="text" name="email">
Pass:<input type="text" name="pw">
<input type="submit" name="send" value="Send">
</form>
</body>
</html>
<?php
}
}
And the index.php:
<?php
require_once "model/Autoload.php";
$view = new View();
$view->createLoginUI();
In the createLoginUI has a link. The link function is load the registry UI. I made this:
public function newSite($view) {
if(isset($_GET['regist'])) {
$view->createRegist();
}
}
I call this method in index.php. If I click the "regist" button, it displays both views. I'd like to see only "regist" view. I tried the header(), but I don't know how can I call a method in header and not sure that it will work.