View Single Post
  #3 (permalink)  
Old 06-22-09, 12:45 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Quote:
Originally Posted by devphp12 View Post
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"];
 }
?>
__________________
Jerry Broughton
Reply With Quote