fairly new php user here.
I've been struggling to find the solution to a very simple problem.
I'm currently creating a feedback system for my school where people can submit a text with a title to certain students, yet after submitting the form it seems the $_Post of my fields are empty.
My html looks like this (The form to be submitted is in a bootstrap modal)
HTML
<div class="modal fade" id="modalWriteFeedback" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<form action="php/feedbackPHP.php" method="post">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h3 class="modal-title" id="modalTitleWriteFeedback">Create New Feedback</h3>
</div>
<div class="modal-body" id="modalContentWriteFeedback">
<div class="form-group">
<label for="txtFeedback">Title:</label>
<input name="title" class="form-control required" type="text" id="txtFeedback">
</div>
<div class="form-group">
<label for="feedbackText">Description:</label>
<textarea class="form-control required" id="feedbackText" rows="15" name="content"></textarea>
</div>
<input type="submit" class="btn-success" name="btnSendFeedback" value="Send">
</div>
</div>
</form>
</div>
</div>
"title" and "content" are to be submitted, which I'm trying in my "feedbackPHP.php"
feedbackPHP.php
<?php
$servername = "*********";
$username = "**********";
$password = "***********";
// Create connection
$db = new mysqli($servername, $username, $password);
// Check connection
if ($db->connect_error) {
die("Connection failed: " . $db->connect_error);
}
$feedbackTitle = $_post['title'];
$feedbackContent = $_post['content'];
$query = /**inserting data in db**/;
echo $feedbackTitle . "<- supposed to not be empty";
mysqli_query($db, $query) or die('msg:' + $feedbackTitle);
//Step3
$result = mysqli_query($db, $query);
mysqli_close($db);
?>
The submit recognized the .php file, and only returns the "<- supposed to not be empty" part.
I have tried with a simple form:
<form action="php/feedbackPHP.php" method="POST">
<input type="text" name="title" id="txtText">
<input type="textarea" name="content" id="txtContent">
<input type="submit" value="go">
</form>
With this as .php
<?php
/**connect to db part**/
$feedbackTitle = $_POST['title'];
$feedbackContent = $_POST['content'];
echo $feedbackTitle . " " . $feedbackContent;
$query = /**insert into db**/;
mysqli_query($db, $query) or die('msg:' + $feedbackTitle);
//Step3
$result = mysqli_query($db, $query);
mysqli_close($db);
?>
And $feedbackTitle & $feedbackContent are working perfectly, even adding the right values in my database.
So according to this is it a problem with the bootstrap modal and the form in it?
I have tried with an Ajax request, the $_POST still seem to be empty. I tried almost every answer on the forum (been busy for almost a day now), but none seem to be working either.
Thanks in advance.
</div>