Is it possible to grab all the variables in a form at once to send to an email or do I need to declare one at a time?

2

Is it possible to grab all the variables in a form at once to send to an email or do I need to declare one at a time?

<form action="welcome_get.php" method="get">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>


    <?php echo $_GET["name"]; ?>
    <?php echo $_GET["email"]; ?>

I had to write each one's name

Is it possible to do for example through a while or something like this so you do not have to type one by one?

    
asked by anonymous 11.10.2016 / 23:17

1 answer

3

You can use a foreach:

foreach ($_GET as $key => $value) {
    echo $key . ' - ' . $value . '<br>';
}
    
11.10.2016 / 23:37