textarea typing translated into HTML ?????

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
civic3x98
Forum Newbie
Posts: 7
Joined: Sun Mar 12, 2006 2:33 pm

textarea typing translated into HTML ?????

Post 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!
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post 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.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
civic3x98
Forum Newbie
Posts: 7
Joined: Sun Mar 12, 2006 2:33 pm

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply