Undefined array key "title" but in only one input [duplicate] - Hack The Tech - Latest News related to Computer and Technology

logo

Get Daily Latest News related to Computer and Technology and hack the world.

Friday, August 11, 2023

demo-image

Undefined array key "title" but in only one input [duplicate]

<form action="opublikuj/index.php" method="post">
        <div class="title">
          <label for="title">Tytuł</label>
          <input type="text" name="titleInput" id="title"/>
        </div>

        <div class="description">
          <label for="description">Opis</label>
          <textarea
            name="descriptionTxtArea"
            id="description"
            cols="21"
            rows="10"
          ></textarea>
        </div>
</form>

opublikuj/index.php:

<?php
$opis = $_POST['description'];
$tytul = $_POST['title'];
echo $tytul."<br>";
echo $opis."<br>";
?>

it gives me an error: Warning: Undefined array key "title" on line 3 but description works perfectly. I tried using id instead of name in PHP but it is still the same.



source https://stackoverflow.com/questions/76878432/undefined-array-key-title-but-in-only-one-input

No comments:

Post a Comment