I'm trying to make a receipt printing website. I want to be able to increment the receipt number each type a new receipt gets printed, for example, first time ever printing, the number will be 1, second time 2, etc. The numbers should not repeat automatically, because doing this manually wouldn't be good since we tend to forget the last number we were on. I have been looking on the Internet for solutions but I have not found any. Please may I have some help? here is what my receipt looks like:
in the place that says "recu n 2839" I want there to be an automatically generated number by order.
here is my form code:
<!DOCTYPE html>
<html>
<head>
<title>Reçu</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<link rel="stylesheet" href="PdfStyles.css">
<link rel="icon" type="image/x-icon" href="img/schoolicon.png">
</head>
<body>
<style>
body {
background-image: url('img/backo.jpg');
}
</style>
<br>
<br>
<div class="hero">
<div class="mt-5">
<form action="pdfmaker.php" method="post" class=" offset-md-3 col-md-6" style="text-align:center;">
<h1 style="color:white">Création de reçu</h1>
<div class="row mb-2 ">
<div class="col-md-6 mb-2"><input type="text" name="nrecu" placeholder="Numéro Reçu" class="form-control" required></div>
<div class="col-md-6"><input type="text" name="fname" placeholder="Élève" class="form-control" required></div>
<div class="col-md-6 mb-2"><input type="text" name="nClass" placeholder="Classe" class="form-control" required></div>
<div class="col-md-6 mb-2"><input type="text" name="Moi" placeholder="Mois" class="form-control" required></div>
<div class="col-md-6 mb-2"><input type="text" name="Mont" placeholder="Montant" class="form-control"></div>
<div class="col-md-6"><input type="text" name="anne" placeholder="Année scolaire" class="form-control" required></div>
<div class="col-md-6 mb-2"><input type="text" name="total" placeholder="Total" class="form-control" required></div>
<div class="col-md-6 mb-2"><form action="/pdfmaker.php">
<label style="font-family:fantasy;font-size:15px"for="cars">Mode de paimenet:</label>
<select name="mode" id="mod">
<option value="Espèce - نقدا">Espèce - نقدا</option>
<option value="Chèque - صك بنكي">Chèque - صك بنكي </option>
<option value="Carte Bancaire - بطاقة بنكية">Carte Bancaire - بطاقة بنكية</option>
</select>
<br><br>
</form></div>
<button style="background-color: #8064A2 !important; font-family:fantasy;font-size:30px" type="submit" class="btn btn-success btn-lg btn-block">Imprimer</button>
</form>
</div>
</div>
</body>
</html>
the "nrecu
" div is the one that takes care of the number, this line:
<div class="col-md-6 mb-2"><input type="text" name="nrecu" placeholder="Numéro Reçu" class="form-control" required></div>
and I believe I'd be able to achieve what I wanted just from this code, but if not, i'll include the pdf maker code, that generates the pdf.
this is the part of the pdf generation code that handles that number: first:
$nrecu=$_POST['nrecu'];
second:
<p style="text-align:center;font-family:monospace;">Reçu N° '.$nrecu.' ايصال رقم </p>
any help will be apperciated.