如何在mysql中更新表单选择2行值

How to update a form select 2 row value in mysql using php

i have this link

floorsedit.php?id=Building1&floorno=1

when i visit this link it is showing blank please tell me why it is showing blank and why it is not update and i think there is a problem thats why it is not showing nothing

$sql="SELECT * FROM $tbl_name where buildingname='".$id."' and floorno='".$floorno."' ";

please help me to fix this issue

thanks ...

this is main page

floorsedit.php

    $host="localhost"; // Host name 
    $username="root"; // Mysql username 
    $password=""; // Mysql password 
    $db_name="building"; // Database name 
    $tbl_name="floors"; // Table name

    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");

    // get value of id that sent from address bar
     $id = $_GET['id']; 

     $floorno = $_GET['$floorno'];

    // Retrieve data from database 
    $sql="SELECT * FROM $tbl_name where buildingname='".$id."' and floorno='".$floorno."' ";
    $result=mysql_query($sql);
    $rows=mysql_fetch_array($result);
    ?>
    <?php
    // close connection 
    mysql_close();
    ?>

and this is a form
<form name="form1" method="post" action="update_ac.php" class="registration_form">

  <fieldset>
    <legend>New Floor </legend>
<input name="id" type="hidden" id="buildingname" value="<? echo $rows['buildingname']; ?>">

    <p>Create A New Floor of Building <span class="style4" style="background:#EAEAEA none repeat scroll 0 0;line-height:1;margin-left:410px;;padding:9px 9px;">Please Fill the All Info </span> </p>

    <div class="elements">
      <label for="buildingname">Building Name  :</label>
      <input type="text" id="buildingname" name="buildingname" value="<? echo $rows['buildingname']; ?>" size="25" />
       <label2 for="floorno">Floor No   :</label2>
      <input type="text" id="floorno" name="floorno" value="<? echo $rows['floorno']; ?>" size="25" />
</div>
    <div class="elements">
      <label for="flatno">Floor No of Flats  :</label>
      <input type="text" id="flatno" name="flatno" value="<? echo $rows['flatno']; ?>" size="25" />

    </div>

    </p >

    <div class="submit">
<input type="submit" name="Submit" value="Submit">
    </div>
  </fieldset>
</form>

update_ac.php

<?php
$host="localhost"; // Host name 
$username="root"; // Mysql username 
$password=""; // Mysql password 
$db_name="building"; // Database name 
$tbl_name="floors"; // Table name 

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// update data in mysql database 
$sql="UPDATE $tbl_name SET buildingname='$buildingname', floorno='$floorno', flatno='$flatno' WHERE buildingname='$id' AND floorno='$floorno'";
$result=mysql_query($sql);

// if successfully updated. 
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='vieweditfloor.php'>View result</a>";
}

else {
echo "ERROR";
}

?>

In the floorsedit.php , use

$floorno = $_GET['floorno'];

rather than,

$floorno = $_GET['$floorno'];

I think the issue is in this line. Hope it helps...