bigrossco Posted December 27, 2006 Share Posted December 27, 2006 I have been able (with help from this form) get a text box to display information from my database but I now want to change this code:[code]echo 'Announcement: <input type="text" name="text" value="'. $row['text'] .'"><br>';[/code]To display as a Text Area when I try:[code]echo 'Announcement: <textarea name="text" value="'. $row['text'] .'"></textarea><br>';[/code]All I get is a blank box and it dose not show the results in it but works fine when used as a text box.Any help would be greatPS Hope you all had a good xmas! Link to comment https://forums.phpfreaks.com/topic/31947-solved-text-area-with-mysql-results/ Share on other sites More sharing options...
Orio Posted December 27, 2006 Share Posted December 27, 2006 That's more a HTML thing. You dont use "value" inside the textarea tag, you put it between the textarea tags.Example:[code]<textarea>Some Value</textarea>[/code]Same goes with variables:[code]<?phpecho "<textarea>".$row['text']."</textarea>";?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/31947-solved-text-area-with-mysql-results/#findComment-148244 Share on other sites More sharing options...
bigrossco Posted December 27, 2006 Author Share Posted December 27, 2006 thanks this dose show the text but now I want ato be able to modify it adn send it back to the database, when i try:[code]<?phpecho "<textarea name="text"> ".$row['text']." </textarea><br>";?>[/code]I get the error message:Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\wamp\www\update-announcement.php on line 140Any ideas? Link to comment https://forums.phpfreaks.com/topic/31947-solved-text-area-with-mysql-results/#findComment-148246 Share on other sites More sharing options...
batman99 Posted December 27, 2006 Share Posted December 27, 2006 Try:[code]<?phpecho '<textarea name="text"> '.$row['text'].' </textarea><br>';?>[/code] Link to comment https://forums.phpfreaks.com/topic/31947-solved-text-area-with-mysql-results/#findComment-148248 Share on other sites More sharing options...
bigrossco Posted December 27, 2006 Author Share Posted December 27, 2006 Thank you batman works gr8 thanks again! Link to comment https://forums.phpfreaks.com/topic/31947-solved-text-area-with-mysql-results/#findComment-148255 Share on other sites More sharing options...
conker87 Posted December 27, 2006 Share Posted December 27, 2006 On a little side note bigrossco, if you're using quotation marks inside of the value you're setting (such as inside a variable or echo) remember to escape the quotation marks with a backslash, as follows:[code]<?phpecho "<textarea name=\"text\"> ".$row['text']." </textarea><br>";?>[/code] Link to comment https://forums.phpfreaks.com/topic/31947-solved-text-area-with-mysql-results/#findComment-148257 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.