检索类型为“ =“”的输入的值

时间:2019-10-08 15:58:41

标签: php

我的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小时前

输出为

欢迎亲爱的Keerthi访问我们的网站 您的电话号码是,电子邮件ID是

我无法在类型为“ =“”和类型为“电子邮件”的字段中检索值

2 个答案:

答案 0 :(得分:0)

问题是您忘记在输入标签中添加“ =”

更改

<input name"phone" type="number">
<input name"email" type="email">

<input name="phone" type="number">
<input name="email" type="email">

答案 1 :(得分:-3)

代替:echo "Your phone number is $phone and your email ID is $email"; 试试这个:echo "Your phone number is".$phone."and your email ID is".$email;