Here is the working code for Get html form post value in same page in php file:
<?php
if(isset($_POST['button'])){ //check if form was submitted
$pohlavie = $_POST['gender']; //get input text
$plat = $_POST['salary']; //get input text
echo "Your gender is ".$pohlavie." and your salary is ".$plat;
}
?>
<center><h1>TAXES</h1></center>
<form action="" method="post">
Name: <input type="text" name="name"><br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="male"> Male<br>
Salary: <input type="number" name="salary"><br>
<button type="submit" name="button" formmethod="post">Calculate DPH</button>
</form>
No comments:
Post a Comment