I want to display an image via an input field and then display it. How do I make it work. In principle, I would simply like to display a picture that serves as a profile picture, which is later saved in a database. But first it should be easy to upload so that it is displayed
function Speichern() {
var Profilbild = document.getElementById('pb').value;
var c = Profilbild + ".png"
document.getElementById('Profilbild').src = c;
}
<div id="Profil">
<img id="Profilbild" src="./Bilder/Profil.png" height="100px" alt="">
</div>
<form action=""onsubmit="Speichern();return false">
<label for="username">Nutzername:</label>
<input id="username" id="username" type="text" placeholder="<?php
echo $_SESSION['username'];
>">
<label for="email">Email:</label>
<input id="email" id="email" type="text" placeholder="<?php
echo $_SESSION["email"];
>">
<label for="pw">Passwort:</label>
<input id="pw" id="pw" type="password" placeholder="<?php
echo $_SESSION["pw"];
>">
<label for="pb">Profilbild:</label>
<input type="file" id="pb" name="pb" accept="image/*">
<button type="submit" >Ändern/Speichern</button>
</form>