auto deleting rows from MySQL on refresh forms

shaymiller

Regular Member
Joined
Dec 3, 2016
Messages
456
Reaction score
45
I have a simple search form to show results on next page using html/php

<form role="form" method="post" action="results.php" name="report">

On on the results.php page, I used POST to get the values of the form. everything works just fine. The issue is when I can hit back and submit that form again, few times. I notices my MYSQL database rows are decreasing. I think this could be result of my submitting an form and hitting back.

is this correct? whats the solution?

results.php
$ExpenseItem=$_POST['ExpenseItem'];


$rtype=$_POST['requesttype'];
 
Your question is not clear.

You are right to access post forms field data with the $_POST variable (as you noted it just works fine).

A search form anyway should execute only a SELECT mysql statement in your DB.
If your script is doing any DELETE statements on executing this form (highly unusual), then this could be indeed the cause.

But I rather guess that your row count is decreasing for an other reason...

You can enable the queries log and investigate what exactly is going on:
https://tableplus.com/blog/2018/10/how-to-show-queries-log-in-mysql.html
I hope this helps.
 
Back
Top