I'm trying to get a persons full name into a text input box when they wish to edit their name. Something like this $sql = "SELECT * FROM users WHERE user_id='$_COOKIE[userid]'"; $result = mysql_query($sql) or die(mysql_error()); $data = mysql_fetch_array($result, MYSQL_ASSOC); echo '<input type="text" name="fullname" value='."$data[full_name]".'>'; The problem is, it only displays the first word in the name. I tried using str_replace to replace the spaces with other characters like %20, +, and  , but it just literally echos those characters rather than the desired effect. Does anyone know a work around? Any help would be appreciated. Thanks
Are you sure it's saved correctly in the DB? Also, you should really do it like this: $sql = "SELECT * FROM users WHERE user_id='" . mysql_real_escape_string($_COOKIE[userid]) . "'"; $result = mysql_query($sql) or die(mysql_error()); $data = mysql_fetch_array($result, MYSQL_ASSOC); echo '<input type="text" name="fullname" value="' . htmlspecialchars($data[full_name]) . '">'; PHP: