abood
abood

Reputation: 5

including php file in joomla to post in table

I have php file (config) in this path joomla/includes and I need to include it with php codes in article page

these codes below doesn't work and not posting anything in the table

    <?php
if (isset($_POST['send'])) {

    require_once JPATH_BASE . '/includes/config.php';

$firstname = $_POST['firstname'];
$fathername = $_POST['fathername'];
$grandfathername = $_POST['grandfathername'];
$familyname = $_POST['familyname'];

$sql = "INSERT INTO subventions (firstname,fathername,grandfathername,familyname) VALUES 
('$firstname','$fathername','$grandfathername','$familyname')";

$inser = mysqli_query($con,$sql);

echo '<script type="text/javascript"> alert("sent"); </script>';

mysqli_close($inser); 
}
?>

I'm using third party plugin "Flexi Custom Code"

Upvotes: 0

Views: 56

Answers (1)

Mike Wood
Mike Wood

Reputation: 154

For security reasons you can't include custom code via editor.

So if you need to add custom code you can do this vía extension, one option is a plugin called Sourcerer, that allows you to add PHP, CSS, JS into joomla! content, including articles and modules. This may be a good option for you.

Upvotes: 1

Related Questions