jasonc Posted September 27, 2011 Share Posted September 27, 2011 For some reason when I try to insert in to my editor page the character • in to the longDescription textarea of the field it shows as a square with four boxes and letters and numbers instead? How do I correctly have it show as it does in mysql and when I echo it on the pages. here are some of the lines in my code that gets the database entries and then echos out the form... $getproducts = mysql_query("SELECT * FROM `products` WHERE `Pid` = '".$posts['product_id']."' LIMIT 1"); $numberofrows = mysql_num_rows($getproducts) or die(mysql_error()); $product_id = mysql_result($getproducts, 0, "Pid"); $longDescription = stripslashes(mysql_result($getproducts, 0, "longDescription")); $posts['longDescription'] = $longDescription; and my form... <textarea name="longDescription" cols="50" rows="8"><?=$posts['longDescription'];?></textarea> and here is my database... CREATE TABLE IF NOT EXISTS `products` ( `Pid` text NOT NULL, `productTitle` text NOT NULL, `longDescription` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Dumping data for table `products` -- INSERT INTO `products` (`Pid`, `productTitle`, `longDescription`) VALUES ('1234', 'The Products Title', '• Something about the product\n• Easy to assemble\n• H:72 x Dia:39cm'); Link to comment https://forums.phpfreaks.com/topic/247958-unable-to-place-%E2%80%A2-in-form-fields-from-mysql/ Share on other sites More sharing options...
freelance84 Posted September 27, 2011 Share Posted September 27, 2011 What is the 'content-type' of your page (<meta http-equiv="Content-Type" content=...) , and the doctype? Secondly, it looks like you are taking a value from the $_POST and inserting it directly into your database, you should be at least running mysql_real_escape_string on any content from the user before using it in any mysql queries. (http://www.phpfreaks.com/tutorial/php-security) Link to comment https://forums.phpfreaks.com/topic/247958-unable-to-place-%E2%80%A2-in-form-fields-from-mysql/#findComment-1273261 Share on other sites More sharing options...
jasonc Posted September 27, 2011 Author Share Posted September 27, 2011 Ah, I had not even added the <html> or other tags yet. I am actually working on the edit page as I manually add the products to mysql using excel. And yes I shall be using mysql_real_escape_string() on all content ! Added the <html> and head tags and all seems to be showing as it should be. thank you for highlighting this, otherwise i may not have got there. Link to comment https://forums.phpfreaks.com/topic/247958-unable-to-place-%E2%80%A2-in-form-fields-from-mysql/#findComment-1273266 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.