Page 1 of 1
textarea typing translated into HTML ?????
Posted: Sun Mar 12, 2006 2:37 pm
by civic3x98
Hi all!
Has anyone see web sites where you type somethign in a text area, just like this ones on this web site...
Typing stuff just like this
you submit the form
and you see what you typed... how you typed it ,.... on the web site...
How do you do that?
I have heard of this PHP function called Tidy... but not sure if thats what i need or something else??
Thanks!
Posted: Sun Mar 12, 2006 2:46 pm
by shiznatix
never saw any of those websites before...
no actually its quite easy, somthing like this will do it:
Code: Select all
echo (empty($_POST['msg']) ? '' : $_POST['msg']);
?>
<form action="this_page.php" method="post">
Message: <input type="text" name="msg">
<input type="submit" value="submit">
</form>
after you grasp that idea you can then move on to storing that data! this forum uses mysql to save its data then uses php to display the data.
Posted: Sun Mar 12, 2006 2:47 pm
by s.dot
anything you type into a form like that you mentioned is POSTed to a page that filters/manipulates the data
say you had this form
Code: Select all
<form action="thispage.php" method="post">
<textarea name="text"></textarea>
<input type="submit" value="submit">
</form>
When whatever they typed in is submitted, it's passed to an array named $_POST.
The value that the person typed in would be in $_POST['text'] (since that's what we named our textarea).
You could do this
Code: Select all
echo "<p>This is what you typed in: {$_POST['text']}</p>";
and it would display -- in HTML -- what the person typed into the textarea box.
Posted: Sun Mar 12, 2006 11:08 pm
by civic3x98
Thanks for the replies.... not quite what i am looking for...
Have you ever been on mySpace.com ?
You type what you want in a text area and submit.
I guess what i am refering to is the format of the text. Like right now i am typing on multiple lines. In a normal text area everything i am typing right now would be concatinated together,,, not on seperate lines like i am writing it now.
I want to hold the format i am typing this message in... Display the data the way its typed... content and format.
Does that make more sense?
Thanks!
Posted: Sun Mar 12, 2006 11:23 pm
by feyd