1

I am performing a search of my sql database, and assigning the data from each row to a variable. Ex.

$query = mysql_query("SELECT * FROM  `PropertyInfo` WHERE  `sitestreet` LIKE  '$street'");
// display query results
while($row = mysql_fetch_array($query))
    {
        $sitestreet = $row['sitestreet'];
        $sitestate =$row['sitestate'];                           
    } 

Now my question is how do I get that info to display as text in a text box?

Thanks!

1
  • note that if your not using left/right wild cards on the like statement like '%$street%' you may as well use where sitestreet = '$street' Commented May 13, 2011 at 16:00

3 Answers 3

2

By echoing a textbox with those variables in the value="" attribute

echo "<input type='text' id='sitestreet' value='$sitestreet' />"
echo "<input type='text' id='sitestate' value='$sitestate' />"
Sign up to request clarification or add additional context in comments.

Comments

1

It's as simple as:

<input value='<?php echo $sitestreet; ?>'>

Comments

0

You can fetch and assign in some time:

while($row = mysql_fetch_array($query))
    {
      echo "<input type='text' id='sitestreet' value='$row['sitestreet']' /><br />
            <input type='text' id='sitestate' value='$row['sitestate']' />";                      
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.