Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php HTML表单未正确提交_Php_Html - Fatal编程技术网

Php HTML表单未正确提交

Php HTML表单未正确提交,php,html,Php,Html,我对编码还是新手,目前我正在用HTML和PHP做一些实验 联系人表单是用HTML创建的,当按下submit按钮时,屏幕上没有显示任何内容。我想现在输入数据,最终我想发送一封电子邮件。HTML和PHP代码可以在下面找到 <!DOCTYPE html> <html> <head> <title>kurtattard.org</title> <link rel="stylesheet" type

我对编码还是新手,目前我正在用HTML和PHP做一些实验

联系人表单是用HTML创建的,当按下submit按钮时,屏幕上没有显示任何内容。我想现在输入数据,最终我想发送一封电子邮件。HTML和PHP代码可以在下面找到

<!DOCTYPE html>

<html>
    <head>
        <title>kurtattard.org</title>
        <link rel="stylesheet" type="text/css" href="style.css">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
    </head>
    <body>
        <header>
            <div class="logo"></div>

            <nav class="nav">
                <ul>
                    <li><a href="index.html">Home</a></li>
                    <li><a href="#">About</a></li>
                    <li><a href="#">Event</a></li>
                    <li><a href="#">Contact</a></li>
                </ul>
            </nav>
            <h1>Contact Us</h1>
        </header>

        <form>

        <div class ="textform">
            <form method="post" action="/contact.php">

                <label>Name</Label>
                <input type="text" name="name" placeholder="Insert your Name and Surname">

                <label>Email</label>
                <input type="text" name="email" placeholder="Insert your email address">

                <label>Message</label>
                <input type="message-box" name="message" placeholder="Enter your message">

                <input type="submit" name="submit">

                <!--<button type="submit" name="submit">Send Mail</button>-->

            </form>

        </div>

    </body>
</html>

Kurtatard.org
联系我们 名称 电子邮件 消息
PHP:

<?php
if(isset($_POST['submit'])){ //someone submitted the form 
    if(isset($_POST['name'])){ //they entered a name or something 
        echo 'hello from '; 
        echo htmlentities(trim($_POST['name']),ENT_NOQUOTES); 
    }else{ //or they did not 
        echo 'type a name'; 
    }
}
?>

问题是您的代码有小的输入错误。您已经添加了额外的open
标记。删除它,您的代码将像魅力一样工作

<!DOCTYPE html>

<html>
    <head>
        <title>kurtattard.org</title>
        <link rel="stylesheet" type="text/css" href="style.css">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
    </head>
    <body>
        <header>
            <div class="logo"></div>

        <nav class="nav">
            <ul>
                <li><a href="index.html">Home</a></li>
                <li><a href="#">About</a></li>
                <li><a href="#">Event</a></li>
                <li><a href="#">Contact</a></li>
            </ul>
        </nav>
        <h1>Contact Us</h1>
        </header>

         <!-- <form>  Remove this -->

        <div class ="textform">
            <form method="post" action="contact.php">

                <label>Name</Label>
                <input type="text" name="name" placeholder="Insert your Name and Surname">

                <label>Email</label>
                <input type="text" name="email" placeholder="Insert your email address">

                <label>Message</label>
                <input type="message-box" name="message" placeholder="Enter your message">

                <input type="submit" name="submit">

                <!--<button type="submit" name="submit">Send Mail</button>-->

            </form>
        </div>

        </body>
</html> 

Kurtatard.org
联系我们 名称 电子邮件 消息
忘了添加我的php代码只需编辑您的帖子请编辑您的帖子以包含php。请尝试让标题反映您的问题,这有点太普通了。谢谢大家。。现在我被重定向到php链接时,点击提交按钮