Page 1 of 1

PHP MYSQL not all values displayed in HTML input value

Posted: Mon Jul 27, 2009 10:39 pm
by Waterskiier23
Hello,

For some reason the code below will only display the first word of the DB column as the value. Any help is much appreciated.

Code: Select all

  
     
$sql = "SELECT * FROM regions WHERE region_id=$id";
$regions = mysql_query($sql) or die(mysql_error());;
 
 
 while($row = mysql_fetch_array($regions))
            {
                $id = $row['region_id'];
                $region_name = $row['region_name'];
                $start_postal = $row['start_postal'];
                $end_postal = $row['end_postal'];
                
            echo "<tr>";
            echo "<th>ID</th><td>" . $id . "</td></tr>";
            echo "<input type=hidden name=region_id value=$id>";
            echo "<tr><th>Region Name</th><td><input type=text valign=center name=region_name value=" . $region_name . "></td></tr>";

Re: PHP MYSQL not all values displayed in HTML input value

Posted: Mon Jul 27, 2009 11:15 pm
by iamngk
Add ' ' in value.... modify the below code...

Code: Select all

value='" . $region_name . "'>

Re: PHP MYSQL not all values displayed in HTML input value

Posted: Mon Jul 27, 2009 11:21 pm
by Waterskiier23
haha... GREAT!! Thanks alot.