I hope everyone is doing well here.
So, Basically, I was working on a modal for my portal, and the conflicting thing is that. Whenever I - Someone tries to fill and Submit the form together. It just sends a single person's data - Into MySQL.
What I have already tried.
The problem I'm facing while using the upper mentioned idea. The query deletes all the dummy values. I can't find a way to delete the data with the same id or something.
This query is for getting the max receipt no. and Putting that value on the input field to show on the modal form - That this is the receipt no. You're filling.
$query = "select MAX(Receipt_no) from payments";
$result = mysqli_query($conn,$query);
$row = mysqli_fetch_assoc($result);
$receipt_no = $row['MAX(Receipt_no)']+1;
$inputterr = $_SESSION['name'];
The second query is creating dummyvalue/ Slot for the users who will take fees. I did this to prevent duplicate entries at the same time.
$query_ru = "insert into payments(id,amount,remarks,receipt_no,full_name,fee_head,payment_mode,timings,inputter,amount_in_words,Month_Of_Payment,cheque_no,ef_no,FEE_TYPE)
values(Null,000000,'dummyvalue','$receipt_no','Fee in Process.','dummyvalue','dummyvalue','dummyvalue','$inputterr','dummyvalue','','dummyvalue','dummyvalue','Fee in process.')";
$exec_tu = mysqli_query($conn,$query_ru);
The below query will update the data of that slot which is made on click to the modal.
$x_id = $_GET['id'] ?? '';
$ef_no = $_POST['ef_no'];
$receipt_no1 = $_POST['receipt_no'];
$name = $_POST['name'];
$remarks = $_POST['remarks'];
$date = $_POST['date'];
$fee_head = $_POST['fee_head'];
$cheque_no = $_POST['cheque_no'];
$payment_mode = $_POST['payment_mode'];
$timings = $_POST['timings'];
$amount = $_POST['amount'];
$FEE_TYPE = $_POST['FEE_TYPE'];
$inputter = $_POST['inputter'];
$amount_in_words = $_POST['amount_in_words'];
$receiving_date11 = $_POST['date'];
$rec_date = date("d-M-Y",strtotime($receiving_date11));
$month_of_payment = $_POST['month_of_payment'];
$mop = date('y-m-d',strtotime($month_of_payment));
$query_t = "update payments set amount='$amount',ef_no='$ef_no',remarks='$remarks',FULL_NAME='$name',FEE_HEAD='$fee_head',PAYMENT_MODE='$payment_mode',AMOUNT_IN_WORDS='$amount_in_words',Month_Of_Payment='$mop',CHEQUE_NO='$cheque_no',TIMINGS='$timings',INPUTTER='$inputter',FEE_TYPE='$FEE_TYPE' where id='$x_id'";
$exec_t = mysqli_query($conn,$query_t);
The same thing is happening on the Cancel button that deletes the row data created when the modal is opened.
<div class="col-lg-6">
<br>
<input type="submit" value="Submit" class="btn btn-primary" name="BtnSave">
<!-- <button class="2 btn btn-danger" name="CancelBtn">Cancel</button> -->
<?php
// echo "<a href='deleteDummy.php?id=$hidden_id' class='2 btn btn-danger'>Cancel</a>";
echo "<a href='deleteDummy.php?id=$hidden_id'><button type='button' class='btn btn-danger' >Cancel</button></a>";
?>
</div>
Problem(2) I blocked refresh on that form as If someone refreshes that form, It doesn't not deletes from the table and Stays remains forever.
Well, I'm looking forward to someone's help. I would appreciate that!
I appreciate any help you can provide. Best, Taha
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by most hosting providers, it is one of the most popular tools for creating dynamic websites.
The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
JQuery is arguably the most popular JavaScript library with so many features for modern development. JQuery is a fast and concise JavaScript library created by John Resig in 2006. It is a cross-platform JavaScript library designed to simplify client-side HTML scripting. Over 19 million websites are currently using jQuery! Companies like WordPress, Facebook, Google, IBM and many more rely on jQuery to provide a kind of web browsing experience.
https://jquery.com/
DBMS is a database management system. It is designed to change, search, add and delete information in the database. There are many DBMSs designed for similar purposes with different features. One of the most popular is MySQL.
It is a software tool designed to work with relational SQL databases. It is easy to learn even for site owners who are not professional programmers or administrators. MySQL DBMS also allows you to export and import data, which is convenient when moving large amounts of information.
https://www.mysql.com/
Welcome to the Q&A site for web developers. Here you can ask a question about the problem you are facing and get answers from other experts. We have created a user-friendly interface so that you can quickly and free of charge ask a question about a web programming problem. We also invite other experts to join our community and help other members who ask questions. In addition, you can use our search for questions with a solution.
Ask about the real problem you are facing. Describe in detail what you are doing and what you want to achieve.
Our goal is to create a strong community in which everyone will support each other. If you find a question and know the answer to it, help others with your knowledge.