Quote:
Originally Posted by devphp12
Hi
m using php as server side script
<form method="post" action="file1.php" name="my">
<text type="text" name="txtname" >
</form>
when i submit data like "My dataa" then it display okay result on next page
but when i submit data like "<p>My data </p>" then it redirect to my website default page
what do i change
Thanx
|
Are you trying to get it to display all the characters "<p>My data </p>" or "My data" formatted in a paragraph?
A typical form, where the data inputted is "<p>My data </p>" :
HTML Code:
<form method="post" action="file1.php" name="my">
Text: <input type="text" name="txtname" >
<input type="submit" value="Submit">
</form>
file1.php, displaying all characters:
PHP Code:
<?php
if(!empty($_POST["txtname"]))
{
echo htmlspecialchars($_POST["txtname"]);
}
?>
file1.php, displaying the text formatted in a paragraph:
PHP Code:
<?php
if(!empty($_POST["txtname"]))
{
echo $_POST["txtname"];
}
?>