Php Get Textbox Value Same Page

Php Program 1: [compare.php]

[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>
[/php]

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]
<?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>
[/php]

Recommended Books:

Leave a Reply