Then you need a slash after it to let it know it is a folder and not a file: action="/portfolio/"
I have a post form that submits but "$_POST" variable is empty even though my web inspector indicates otherwise
-
20-06-2023 - |
Question
Here is my html:
<form id="quant" method="POST" action="/portfolio" name="trans">
<div class="modal-body">
Shares : <input autocomplete="off" type="text" name="quantity">
<input type="hidden" value="<?= htmlspecialchars($_GET['q']); ?>" name="stock">
<input type="submit" name="val" value="Confirm Transaction" class="btn btn-primary">
<div id="slider-range-max"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
Here is an image of my web inspector showing that in fact that data was requested:
I have been trying to figure out why this has not been working for a long time, any suggestions would be appreciated.
The Code:
if(isset($_POST["quantity"])) {
var_dump($_POST);
which returns nothing
Solution
OTHER TIPS
If you're using something like AngularJS to submit your form, it doesn't send POST data the typical way. Check out this post.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow