PHP - 显示错误的 echo [重复]

问题描述 投票:-1回答:1

所以问题被删除了,所以............。

php html echo
1个回答
3
投票

你需要改变 GETPOST 这样

<?php 
    if(isset($_POST['submit'])){
        if(empty($_POST['email'])){
            echo 'An email is required <br />';
        } else {    
            $email = $_GET['email'];
        }
        if(empty($_POST['title'])){
            echo 'A title is required <br />';
        } else {
            $title = $_GET["title"];
        }
        if(empty($_POST['ingredients'])){
            echo 'At least one ingredient is required <br />';
        } else {
            $ingredients = $_GET["ingredients"];
        }
    } 
 ?> 
<html>
<form action="index.php" method="POST" class="white">
            <label> Your email:</label>
            <input type="text" name="email">
            <label> Pizza title:</label>
            <input type="text" name="title">
            <label> Ingredients</label>
            <input type="text" name="ingredients">
            <div class="center">
                <input type="submit" name="submit" value="submit" class="btn brand z-depth-0">
            </div>
        </form>
</html>
© www.soinside.com 2019 - 2024. All rights reserved.