I know how to do it in Codeigniter, but i’m struggling to find a solution for procedural PHP. Can’t find anything similar on net about my problem
<form action="demo.php">
<input type="text" id="demo" name="demo"/>
</form>
demo.php page
class Test {
function example1() {
--some code here---
}
function example2() {
$db = Connection::getInstance()->conn;
$q = $db->query("INSERT INTO test (name, lastname, text) VALUES('$name', '$lastname', '$text')");
if($q){
echo "Inserted";
}
else{
echo "Not inserted";
}
}
}
I would like to call, for example method “example2()” from my “demo.php” page that has class “Test” in it, from my form’s action tag.
How would i do this?
Thank you in advance!