Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

User's Input in PHP using Single File:-

We can write PHP Script under HTML page but extension should be .php.We can not write PHP Script under .html file because .html file contain only static data hence, if we want to write PHP Code script then the page extension should be .php.

We can manage input operation in the same file.

Complete Program of PHP:-

Create .php file and write the below code under this.

<!DOCTYPE html>
<form action="" method="post">
<input type="text" name="txtnum1" placeholder="Enter First Number" />
<input type="text" name="txtnum2" placeholder="Enter Second Number" />
<input type="submit" name="btnsubmit" value="Addition" />

$num1 = $_REQUEST['txtnum1'];
$num2 = $_REQUEST['txtnum2'];
$num3 = $num1+$num2;
echo $num3;

Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post