Php Get Textbox Value Same Page

(Last Updated On: November 9, 2013)

Php Program 1: [compare.php]

<?php error_reporting(E_ALL ^ E_NOTICE); ?>
<?php
$test = $_POST['pname'];
if($test){
	echo $test;
}else{
	
}
 ?>
<form method="post" action="compare.php">
Input Please :<input type="text" name="pname" id="pname	"/> 
</form>

Output:
getting textbox value in php samepage
getting textbox value in php samepage
getting textbox value in php samepage

Php Program 2: [compare.php]

<?php error_reporting(E_ALL ^ E_NOTICE); ?>
<?php
$input = $_REQUEST ['pname'];
echo $input;
 ?>
<form method="post" action="compare.php">
Input Please :<input type="text" name="pname" id="pname	"/> 
</form>

Recommended Books:

413 total views, 0 views today

Leave a Reply

Your email address will not be published. Required fields are marked *