Hello everyone:),
I’m new with kirby
I want to implement a simple newsletter funktionallity. I set up a form with name and email and want to deligate to php. its a simple insert in a mysql database.
out of kirby it works. when i implement it always delegates me to 404 not found. not sure how kirby works.
<h3>Newsletter</h3>
<p>Abonieren Sie unseren Newsletter!</p>
<form action="site/snippets/sections/Newsletter.php" method="POST">
<div class="grid__column">
<label>Vor- und Nachname (Pflichtfeld)</label>
<input name="newslettername" type="text" class="form-field"/>
<label>E-Mail-Adresse (Pflichtfeld)</label>
<input name="newsletteremail" type="email" class="form-field"/>
</div>
<div class="grid__column">
<br /><br />
<input type="checkbox" name="terms" value="1"/>
<label for="terms" class="terms">Mit dem Absenden Ihrer Anfrage erklären Sie sich mit der Verarbeitung Ihrer
angegebenen Daten zum Zweck der Bearbeitung Ihrer Anfrage einverstanden. Weitere Informationen erhalten Sie
auf der Seite <a href="datenschutz" class="meta-nav__link">Datenschutz</a></label>
<?php echo csrf_field() ?>
<?php echo honeypot_field() ?>
<p id="message" class="error-messages"></p>
<input type="submit" class="button" value="Senden">
</div>
</form>
<?php
$user = "";
$password = "";
$host = "localhost";
$dbase = "";
$table = "Newsletter";
$newslettername= $_POST['newslettername'];
$newsletteremail= $_POST['newsletteremail'];
// Connection to DBase
$dbc= mysqli_connect($host,$user,$password,$dbase)
or die("Unable to select database");
//$query= "INSERT INTO $table ". "VALUES ('$first_name', '$last_name', '$email')";
$query= "INSERT INTO Newsletter (Name, EMail) VALUES ('$newslettername', '$newsletteremail')";
mysqli_query ($dbc, $query)
or die ("Error querying database");
echo 'You have been successfully added.' . '<br>';
mysqli_close($dbc);
?>
how can i realize that?