Ask Question


Need a Website Or Web Application Or Any Help In Code As Per Your Budget, Contact Us: +91 9437911966 (Whatsapp)

How to show fetch data in text field or input box using PHP

In this topic i am going to show you how to fetch data and show in a text field or input box.

Here we using two file for fetch data.

  1. database.php(For connect to database)
  2. index.php(Fetch data from database)


$dbname = "crud";
die('Could not Connect My Sql:' .mysql_error());


<!DOCTYPE html>
<title> Retrive data</title>
<h2>City name</h2>
<form method="post" action="">
<input type="text" id="first_name" name="first_name" value="<?php echo $DB_ROW["first_name"]; ?>">
<input type="text" id="last_name" name="last_name" value="<?php echo $DB_ROW["last_name"]; ?>">
<input type="text" id="city" name="city" value="<?php echo $DB_ROW["city_name"]; ?>">

Related Topic

Fetch data show in select box

Fetch data show in checkbox

Fetch data show in radio button

Fetch data show in text box