我只是tottaly與PHP的新手,我現在正在學習如何將PHP與HTML表單結合起來。我想它在一個文件中,所以我想這:表單和PHP在一個文件中
<?php
if(isset($_POST['button'])){ //check if form was submitted
$pohlavie = $_POST['gender']; //get input text
$plat = $_POST['salary']; //get input text
$plat = "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>
不幸的是,它從字面上無所事事提交後。你能幫我一點嗎?
那麼,你想要做什麼?打印結果? – manian
你沒有對你的變量做任何事情。你需要回應他們。 – Hunter
是的,我忘了回聲!對不起。 –