我剛剛寫了我的第一個PHP代碼或試圖反正。一個非常簡單的電子郵件提交表單。但它不是正確提交。任何人都可以指導我走向哪裏我錯了嗎?謝謝。PHP表單動作和提交
下面是該html的網頁
<form action="request-info.php" method="post" name="request-info">
<input name="name" type="text" value="Name">
<input name="email" type="text" value="E-mail Address">
<p>More information for</p>
<input name="family" type="radio" value="Family Member">Family
<br>
<input name="friend" type="radio" value="Friend">Friend
<br>
<input name="myself" type="radio" value="Myself">Myself
<br>
<input name="submit" type="button" value="Submit"> | <input name="reset" type="reset" value="Reset">
</form>
下面的表單代碼是什麼,我有行動頁面上。我認爲這是我可能會犯錯的地方。我應該在這裏提交與提交按鈕相關的內容嗎?
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$family = $_POST['family'];
$friend = $_POST['friend'];
$myself = $_POST['myself'];
$to = "[email protected]";
$subject = "Information Request";
mail ($to, $subject, $info, "From: " . $name . $email);
echo "Your request has been sent!";
?>
感謝
嘗試更改 to type =「submit」 – Dan
感謝您的回覆如此之快。有效。 – Josh