$_Post undefined variable var_dump

2019-06-14 18:06发布

问题:

Hey I'm creating my first php form and really struggling with what I'm doing wrong here;

this is the form:

               <form method="post" action="includes/contact-process.php">

                    <table>
                        <tr>
                            <th>
                                <label for="name">Name</label>
                            </th>
                            <td>
                                <input type="text" name="name" id="name">
                            </td>
                        </tr>
                        <tr>
                            <th>
                                <label for="email">Email</label>
                            </th>
                            <td>
                                <input type="text" name="email" id="email">
                            </td>
                        </tr>
                        <tr>
                            <th>
                                <label for="message">Message</label>
                            </th>
                            <td>
                                <textarea name="message" id="message"></textarea>
                            </td>
                        </tr>                    
                    </table>
                    <input type="submit" value="Send">

                </form>

and this is the contact-process.php

<?php

var_dump($_Post);

?>

and this is what it keeps returning:
Notice: Undefined variable: _Post in \includes\contact-process.php on line 3 NULL

回答1:

It should be $_POST, not $_Post :

<?php
    var_dump($_POST); 
?>


回答2:

$_POST is case sensitive, $_POST is not same as $_Post so try

var_dump($_POST);


标签: php forms