If you don't want to refresh the entire page, you need to use some Javascript/Ajax.
JQuery allows to perform what you need very easily with the .post() method.
First add the JQuery file to your HTML header
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
Then create a .php file with your request (for example : update_owner.php) :
<?php
// 1. Connect to your SQL database
// ...
// 2. Get the type
$type = $_POST['type'];
// 3. Perform your query
$results = mysql_query("SELECT * FROM owner where type=".$type);
// 4. Get the only result you want (the first row)
$row = mysql_fetch_array( $results );
// 5. Return the result in json format (assuming that the name
echo json_encode(array("responseCode" => 200, "row" => $row));
Then add some javascript (which uses JQuery) :
$("select#type").change(function() {
// Get the value of your input field
var type = $(this).val();
// Set the URL
var url = 'update_owner.php';
// Start send the post request
$.post(url,
function(data){
// The response is in the data variable
if (data.responseCode == 200) {
// Write the name in the right cell (with #owner id)
$("#owner").html( data.row.name );
}
else {
// Bad request
}
},"json"
); // Make sure the the response is in json format
return false;
});
That should do it
PS : I apologize for my bad english... I'm french