Hey, this is my first post here, so greetings lol. Back to the topic, Is it possible to make a text box that can put the text into html code and if so how? Sort of like the box you type your post's with on forums or blogs.

7 Years
Discussion Span
Last Post by diafol

This is normally done using MySQL or MongoDB to save the data and PHP to display it.
You can use flat files but then you loose a lot of the power you can get from databases like MySQL or MongoDB
A simple, flat-file example would be

//Output whatever is stored in the file
@echo file_get_contents('./storage');
<!--Make a form for input-->
<form method="POST" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
<input type="text" name="input" /><input type="submit" />

//If the form has been submitted
if ( isset($_POST) ) {
    //Open the file for writing (w)
    $f = fopen('./storage', 'w');
    //Write the string
    //Close the file

(Not tested)
That code is very insecure and using files is very inefficient as opposed to databases.
If you check out http://tizag.com/ they have good tutorials on both PHP files and MySQL with PHP.


You have two main options. Either use a plain textbox and use BBCode or use a WYSIWYG editor.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.