How to print the mysql result using form form which is readonly

Problem :

the output didt display on the readonly form

How to print the sql result to the form which is readonly

Provide html code and action.php code. I have try to use &result on readonly form value

   <form action = "action.php" method="post" >
      input: <input type="text" name="v_id" />
      <input type="submit" />

      $dbhost = 'localhost';
      $dbuser = 'root';
      $dbpass = 'password';
      $conn = mysql_connect($dbhost, $dbuser, $dbpass);
      if (!$conn) {
         die('Could not connect: ' . mysql_error());
      $id = $_POST['v_id'];
      $sql = "SELECT v_price " .
              "FROM vehicle  " .
              "WHERE v_id = $id";
      $result = mysql_query($sql);
   <label for="textfield">output:</label>
   <input name="textfield" 
          value = "<?php $result ?>">

Solution :

you forgot the "echo" and btw you could have the same result with less typing:

  <input type="text" readonly value="<?php echo $result ?>">

EDIT: as fred -ii- pointed out, this will only work if $result was set. If you want to display something in case of request failure, simply set $result to a default value, something like:

<?php echo $result ? $result : "undefined"; ?>

And also your sql query is incomplete. Read the PHP manual and see how it's done.

Mysql Tutorials

Mysql Howto..

Pound sign shows as A£ when entering it into mysql

How can I create index for a table with combined primary key?

How to persist such data in mysql

how to upload more than one image to server(mysql database) using php and android

how to get data after sql inerst command in php [duplicate]

How to avoid mysql injections using PDO

How to host online for free my simple Java webapp (in .war format) and have a mySQL DB for testing [closed]

PHP/mySQL: How can I retrieve HTML/PHP code stored in a mySQL table and not have the PHP commented out?

How to solve Dilemma of storing human names in MySQL and keep both discriminability and a search for similar names?

How to Display Dates in Calendar View from Database

How to structure an embedded mysql query to first select data that matches two columns and then match results to a third column?

how to migrate msAccess Database to MySQL with relationship?

How to make the Order by statement for Two fields in a single query and one field needs to DESC and one field needs to ASC using Mysql?

Not how to create a session timeout in Php, but where?

how can I detect deadlocks in MySQL? What could cause my application to hang when making a connection?

How to save PHP HTTP_USER_AGENT to MySQL field

How do I save the captured image of a signature to MySQL

How to ask javascript wait for mysql assign value to php variable?

How to dont let users save the same item twice in mysql

How to select/match from MySQL table?

How to know very first value inserted in table in mysql [closed]

Select from mysql database with winforms - how to check response?

How to change MySQL Primary Key from signed to unsigned?

How do I make a MySQL statement from ID to ID

How to create sql script that generates insert statements with tables data in mysql/mssql

How to extract only the last name in MySQL?

How to set environment variables for Laravel 5 on AWS EC2 with MySQL

How to Display the Total Order Amount per Day in a Chart

How to Display result of subquery rows as one column in MySQL?

how to skip entries that are NULL in MySQL