Answer the question
In order to leave comments, you need to log in
How to display the number of successful Bitrix form submissions?
There is a submission form, it has an input of the number of projects, now it displays an increasing number when the page is updated, with this script:
<?php
session_start();
$nom = isset($_SESSION["nom"]) ? intval($_SESSION["nom"] + 1) : 1;
$_SESSION["nom"] = $nom = $nom > 999 ? 999 : $nom;
echo $nom < 10 ? "00".$nom : ($nom < 100 ? "0".$nom : $nom);
?>
<form id="deal_form_lk" class="sform" action="javascript:void(null);" onsubmit="send_form_lk('deal_form_lk')">
<div class="input-group col-12 col-md-6">
<input id="nomerForm" type="text" name="nomerForm" placeholder="" class="form-control" value="№ проекта: <?=substr("00".$nom, -3);?>" readonly/>
</div>
<button id="deal_btn" type="submit" class="modal_btn round-btn-style btn-style">Отправить</button>
Answer the question
In order to leave comments, you need to log in
As I understand it, it is possible to write a number to a file like this code, but I can’t integrate it in any way:
or am I mistaken?
if (isset($_POST['submit'])) {
if (!file_exists('count.txt')) {
$cnt = 1;
$f = fopen('count.txt', 'w+');
fwrite($f, $cnt);
fclose($f);
} else {
$f = fopen('count.txt', 'r');
$cnt = (int) fgets($f);
fclose($f);
$cnt++;
$f = fopen('count.txt', 'w+');
fwrite($f, $cnt);
fclose($f);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question