dimanche 31 octobre 2021

How to Show Profile Picture of User on Change password form (Picture of Logged In user should be show) in HTML/PHP

I'm working on a little project, I've created and linked change password form and used update query, form is working very well, but I want to show user's image on the change password form, Below is my code, when I used session variable and add php code in form, then my already fixed image also become hidden whereas, I don't want to show fixed image I want to show user's image, Please help me to correct it. I used if else and switch statement but only else statement is executing.

<div class="container"> <h1>CHANGE YOUR PASSWORD</h1> <div class="contact-form"> <div class="profile-pic"> <?php if (isset($_SESSION['username'])){ $username = !empty($_SESSION['username']) ? $_SESSION['username'] : false; switch ($username) { case 'admin': case 'Admin': case 'ADMIN': ?> <img src="profile_pics/4.png" alt="User Icon"/> <?php break; case 'muhammad azeem': case 'Muhammad Azeem': case 'MUHAMMAD AZEEM': ?><img src="profile_pics/1.png" alt="User Icon"/> <?php break; case 'muhammad adnan': case 'Muhammad Adnan': case 'MUHAMMAD ADNAN': ?><img src="profile_pics/2.png" alt="User Icon"/> <?php break; case 'saleem raza': case 'Saleem Raza': case 'SALEEM RAZA': ?><img src="profile_pics/3.png" alt="User Icon"/> <?php break; case 'abdul raheem': case 'Abdul Raheem': case 'ABDUL RAHEEM': ?><img src="profile_pics/5.png" alt="User Icon"/> <?php break; } } else{ ?> <img src="images/1.png" alt="User Icon"/> <?php } ?> </div> <div class="signin"> <form action="process_change_password_form.php" method="POST"> <input type="text" name="current_password" class="user" value="Current Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Current Password';}" id="1" required> <input type="text" name="new_password" class="user" value="New Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'New Password';}" id="1" required> <input type="text" name="confirm_new_password" class="user" value="Confirm New Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Confirm Password';}" id="1" required> <input type="submit" value="Change Password" name="submit" /> </form> </div> </div> </div> </body> </html>

Aucun commentaire:

Enregistrer un commentaire