My HTML form not work but in code is all fine, actually

  Kiến thức lập trình

Below I have two codes, one in html and one in php. the form when I press the send button does not work and in php the post variable is empty, no variable is sent and I want help to see what the problem is.

HTML FORM:

                <p class="p-title-form" style="text-align: center; font-size:20px; font-weight:bolder; text-decoration:underline;">Creare eticheta</p>
                <div class="component-form-v">
                    <div class="div-s-row">
                        <label class="label">Cod bare produs</label>
                        <i onclick="WarningBarcode()" class="icon-hint fa-solid fa-circle-question"></i>
                    </div>
                    <input type="text" name="barcode" id="bari" class="input" maxlength="20" pattern="[0-9]+" placeholder="Barcode">
                </div>
                <div class="component-form-v">
                    <div class="div-s-row">
                        <label class="label">Name</label>
                        <i onclick="WarningNameProd()" class="icon-hint fa-solid fa-circle-question"></i>
                    </div>
                    <input type="text" name="name" required class="input" minlength="1" maxlength="25" placeholder="Nume produs">
                </div>
                <div class="component-form-v">
                    <div class="div-s-row">
                        <label class="label">Price</label>
                        <i onclick="WarningPrice()" class="icon-hint fa-solid fa-circle-question"></i>
                    </div>
                    <input type="text" name="pret" required class="input" minlength="1" pattern="[0-9,.]+" placeholder="Price">
                </div>
                <div class="component-form-v">
                    <div class="div-s-row">
                        <label class="label">Contine Garantie?</label>
                    </div>
                    <select name="SGR" id="garantie" class="select">
                        <option value="0">Nu</option>
                        <option value="1">Da</option>
                        <option value="NaN">Nu se stie</option>
                    </select>
                </div>
                <input type="submit" name="submit" class="button btn" value="Creeaza eticheta">
            </form>

PHP Code:


include_once("./dbch.php");


if (isset($_POST["submit"])) {
    
    //another code to run 

} else {
    // Afisam mesaj pentru debugging
    echo "FORM IS NOT SEND!"; // this error apear all time 
}
?>

PS: Some varables/attributes names is in romanian language and you can google translate for translate words, if exist

I tried and modify code to be code simple but not work all my ideas…

New contributor

Emil is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT