does php mysql_fetch_array works with html input box?

Posted by dexter on Stack Overflow See other posts from Stack Overflow or by dexter
Published on 2010-03-18T09:32:34Z Indexed on 2010/03/18 9:41 UTC
Read the original article Hit count: 385

Filed under:
|
|

this is my entire PHP code:

<?php if(empty($_POST['selid']))
        {echo "no value selected";  }
        else 
        {
            $con = mysql_connect("localhost","root","");
            if(mysql_select_db("cdcol", $con))
                {
                    $sql= "SELECT * FROM products where Id = '$_POST[selid]'";

                    if($result=mysql_query($sql))
                    {   

                        echo "<form name=\"updaterow\" method=\"post\" action=\"dbtest.php\">";
                        while($row = mysql_fetch_array($result))
                        { 
                        echo "Id :<input type=\"text\" name=\"ppId\" value=".$row['Id']." READONLY></input></br>";
                        echo "Name :<input type=\"text\" name=\"pName\" value=".$row['Name']."></input></br>";
                        echo "Description :<input type=\"text\" name=\"pDesc\" value=".$row['Description']."></input></br>";
                        echo "Unit Price :<input type=\"text\" name=\"pUP\" value=".$row['UnitPrice']."></input></br>";
                        echo "<input type=\"hidden\" name=\"mode\" value=\"Update\"/>";

                        }
                        echo "<input type=\"submit\" value=\"Update\">";
                        echo "</form>";
                    }
                    else {echo "Query ERROR";}
                }
        }
?>

PROBLEM here is, ....if the value i am getting from database using mysql_fetch_array($result) is like:(say Description is:) "my product"

then; in input box it shows only "my" the word(or digit) after "SPACE"(ie blank space) doesn't get displayed? can input box like above can display the data with two or more words(separated by blank spaces)?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql