Backgroud / Idea I am creating a web aplication from scratch; with out any type of php framework. I am creating the web application in this way; because i want to LEARN php; and i think that use a php framework do not will mame me a good php developer.
What i did so far? I create a project structure:
- Project
- css
- script
- Models
- Controllers
- Views
- Resource
I created one view like:
<html>
<head>
<!-- here i call my jquery.js -->
<script>
...
function action()
(
...
$.ajax(url: "/Controllers/HomeController.php", type:"POST",DataType:"JSON",Parameter:{var1:$("#var1").val(),method:"singup"})
{...}
...
)
...
</script>
</head>
<body>
<input id="var1" name="var1" type="text">
<input id"mybutton" name="mybutton" type="button" onclick="action();">
</body>
</html>
In my HomeController.php
<?php
if(if(is_set($POST('method'))))
{
if(function_exist($POST('method')))
{
switch($POST('method'))
{
case "singup":
$var1 = $POST('var1')
singup($var1);
break;
...
default: break;
}
}
}
function singup($var1)
{
$array = {"var1" => $var1};
json_decode($array,1);
}
?>
Questions
I am not really sure about this code (security). I want to know: What is the recommended way make call between views and controllers with out use any type of php framework ?