473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

retrieve value from mysq DB & display in textboxe based on value inputed to other tex

i want to display house rent from the database depending on the house number.I have written the following code.This code neither gives an error nor displays the corresponding house rent from the DB


<td><label >26. House No.***(C179)</label></td> <td><input type="text" name="houseno" size="5" maxlength="5" tabindex=25 onblur="checkName2(this.value)" value="<?php if ($done==false && isset($_POST['submit'])) echo $_POST['houseno'];?>"></td> </tr> <tr> <td>27. House Rent</td> <td><input type="text" name="house_rent" size="4" tabindex=26 maxlength="4" onBlur="checkNumber2(this.value)" ></td> <?php
if(isset($_POST['houseno']))
{
$houseno =$_POST['houseno'];
$sql2 = mysql_query("select * from house_rent where HOUSE_TYPE='$houseno' ") or die(mysql_error());
$result = mysql_query($sql2);

while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['RENT'] ."'>" . $row['RENT'] ."</option>";
}
echo "</select>";
}
?> </tr> <tr>
Mar 13 '14 #1
1 1039
Expand|Select|Wrap|Line Numbers
  1. <td><label >26. House No.***(C179)</label></td> <td><input type="text" name="houseno" size="5" maxlength="5" tabindex=25 onblur="checkName2(this.value)" value="<?php if ($done==false && isset($_POST['submit'])) echo $_POST['houseno'];?>"></td> </tr> <tr> <td>
  2.  
  3.  
  4.  
  5.  <td>27. House Rent</td>
  6.     <td><input type="text" name="house_rent" size="4"  tabindex=26 maxlength="4" onBlur="checkNumber2(this.value)" ></td>
  7.  <?php
  8. if(isset($_POST['houseno']))
  9. {
  10.  $houseno =$_POST['houseno'];
  11.     $sql2 = mysql_query("select * from house_rent where HOUSE_TYPE='$houseno' ") or die(mysql_error());
  12.     $result = mysql_query($sql2);
  13.  
  14.     while ($row = mysql_fetch_array($result)) {
  15.     echo "<option value='" . $row['RENT'] ."'>" . $row['RENT'] ."</option>";
  16.     }
  17.     echo "</select>";
  18. }
  19.     ?>
  20.  
  21.  
  22.  
  23.  
This is the code
Mar 13 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RelaxoRy | last post by:
I have 3 texfield boxes 1. firstname 2. lastname 3. username When a person enters in their firstname and lastname, I want the username field to fill with firstnameLastinitial. Eg. ...
38
by: MLH | last post by:
I have 2 global constants declared in the same global module: Global Const MY_VERSION$ = "1.04" Global Const ProjectName$ = "MyProj" I have 2 global procedures designed to return the value of...
3
by: technocraze | last post by:
Hi community experts, May I knw whether is it possible to display the corresponding value of the second textbox based on the user input in the first textbox? This means that once the user enters...
11
by: AishaKhalfan | last post by:
Hi all, I have to populate combo box that retrieve data from database in windows based application. I have two tables which are type and CD. Type has type ID and Category. CD has type ID as...
14
by: PhilS | last post by:
Hi everybody, I'm new to the forum and Access and hope you can help with the following question using Access 2000: I would like to have a value displayed in a text box based upon two other values....
2
by: itpvision | last post by:
Hello, I have a link navigation of categories retrieved from the database, while I know how to display subcategories based on category link clicked with classical approach, I want to do this with...
7
by: RachH | last post by:
I am using Access 2003 and need some guidance on the correct way to reference a variable in two different procedures when the variable's value is based on a SQL query. The database form has a...
2
by: sumanta123 | last post by:
Dear Sir, In my develpment i am getting stuck for a senario.Kindly please help me for it. Everytime we give the request we get the response of 8 records and its corresponding value. Then next...
0
by: So Confused | last post by:
I have a drop down selection menu on an HTML form. I want to display 1 answer, for a few selection options.... and another answer for the rest of the options. Example code is below: How Much...
2
David Blackman
by: David Blackman | last post by:
I have a form with 4 unbound listboxes (LB). When the form opens, I want: 1. LB1 to display values in row 1; 2. LB3 to display data based on the value of LB1; 3. LB4 to display data based...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.