Current location: Hot Scripts Forums » Programming Languages » PHP » Problem in post data with HTML Tag

Problem in post data with HTML Tag

Reply
  #1 (permalink)  
Old 06-21-09, 10:30 AM
devphp12 devphp12 is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Problem in post data with HTML Tag

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-21-09, 10:44 AM
smithygotlost smithygotlost is offline
Coding Addict
 
Join Date: Jul 2006
Location: United Kingdom
Posts: 347
Thanks: 7
Thanked 0 Times in 0 Posts
if that is the only coding you have thats probally why

what you need is a form like you got but with some php

Code:
if ($_POST["textname"] != ""){
				$text= $_POST["textname"];
				echo "You Submitted $text";
				exit;

				}
				echo "<form method=\"post\">
				Text: <input name=\"txtname\" type=\"text\" value=0 /><br />
				<input name=\"\" type=\"submit\" value=\"Submit\" />
				</form>";
if you wanna receive the text on another page then do something like

Page1.php

Code:
				echo "<form method=\"post\" action=\"page2.php\">
				Text: <input name=\"txtname\" type=\"text\" value=0 /><br />
				<input name=\"\" type=\"submit\" value=\"Submit\" />
				</form>";
Page2.php
Code:
				if ($_POST["textname"] != ""){
				$text= $_POST["textname"];
				echo "You Submitted $text";
				exit;

				}
That should give you a good idea

Good luck

Mike
__________________
Make People Friendly Say " Thanks "
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-21-09, 11:45 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 2,726
Thanks: 0
Thanked 32 Times in 32 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with displaying data kavionly PHP 2 05-25-09 10:29 AM
html tutoral thefrtman HTML/XHTML/XML 5 04-27-09 10:25 AM
html input value with php variable data AnnPage HTML/XHTML/XML 5 04-23-09 12:18 PM
Help extracting data from html and writing it to mysql? method PHP 2 06-12-08 11:53 AM
Problem getting data from DataGrid on update petersza ASP.NET 5 10-19-04 11:37 PM


All times are GMT -5. The time now is 06:08 PM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.