[英]retrieve value of a input with type=“number”
我的 HTML 代碼
<html>
<head>
</head>
<body>
<form action="process.php" method="post">
<lable>Name</lable>
<input name="name" type="text">
<lable>Phone</lable>
<input name"phone" type="number">
<lable>Email</lable>
<input name"email" type="email">
<input type="submit" name="submit">
</form>
</body>
</html>
我的 PHP 代碼
<?php
if(isset($_POST['submit']))
{
$name = $_POST['name'];
$phone = $_POST['phone'];
$email = $_POST['email'];
echo "Welcome dear $name to our website, <br>";
echo "Your phone number is $phone and your email ID is $email";
}
?>
我在這里做錯了什么? Veeraj · 講座 36 · 2 小時前
Output 是
歡迎親愛的 Keerthi 訪問我們的網站 您的電話號碼是,您的 email ID 是
我無法在 type="number" 和 type="email" 的字段中檢索值
問題是您忘記在輸入標簽中添加“=”
改變
<input name"phone" type="number">
<input name"email" type="email">
至
<input name="phone" type="number">
<input name="email" type="email">
而不是: echo "Your phone number is $phone and your email ID is $email";
試試這個: echo "Your phone number is".$phone."and your email ID is".$email;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.