Login Register






[PHP] User outputted text filter_list
Author
Message
[PHP] User outputted text #1
Hey everyone, here i a very simple html/php code which allows the user to print what ever text is entered.

PHP Code:
<html> <body> <form action='test.php' method='POST'> Text Area: </br><input type="text" size="65" rows="2"; maxlength="250" name="output"/> <input type='submit' name='submit' value='Post'><br><br> <?php $submit = strip_tags($_POST['submit']); $output = strip_tags($_POST['output']); if ($submit) { echo $output; } ?> </body> </html>

Just save the file as test.php and run it, it is a very good code for beginners to use html and php together.
[Image: 6caf54.gif]

Reply

RE: [PHP] User outputted text #2
Simple code... Its fine but I think you should change this part :
PHP Code:
<?php $submit = strip_tags($_POST['submit']); $output = strip_tags($_POST['output']); if ($submit) { echo $output; } ?>

TO :
PHP Code:
<?php if(isset($_POST['submit']) && isset($_POST['output'])) { $output = strip_tags($_POST['output']); echo $output; } ?>

No need of using another variable for $_POST['submit']....

Reply