html - $_Post seems to not return a variable after form submit php -


fairly new php user here.

i've been struggling find solution simple problem.

i'm creating feedback system school people can submit text title students, yet after submitting form seems $_post of fields empty.

my html looks (the form submitted in 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">&times;</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" , "content" submitted, i'm trying in "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 not empty";  mysqli_query($db, $query) or die('msg:' + $feedbacktitle);  //step3 $result = mysqli_query($db, $query); mysqli_close($db);  ?> 

the submit recognized .php file, , returns "<- supposed not empty" part.

i have tried 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 .php

<?php /**connect db part**/  $feedbacktitle = $_post['title']; $feedbackcontent = $_post['content'];  echo $feedbacktitle . " " . $feedbackcontent;  $query = /**insert db**/;  mysqli_query($db, $query) or die('msg:' + $feedbacktitle);  //step3 $result = mysqli_query($db, $query); mysqli_close($db);  ?> 

and $feedbacktitle & $feedbackcontent working perfectly, adding right values in database.

so according problem bootstrap modal , form in it?

i have tried ajax request, $_post still seem empty. tried every answer on forum (been busy day now), none seem working either.

thanks in advance.

use $_post, not $_post :-)

php case sensitive, , same $_get, $_session, $_server, [...]

http://php.net/language.variables.superglobals


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -