WanderRook
WanderRook

Reputation: 81

Elegant & easy way to user get & post together in form method

Which magic I can use to send value name on email, but I need also to show it on example.php, when I cant user get & post together?

html:

<form target="_blank" action="email_ok.php" method="post"> 
Name:<br>
<input type="text" name="name" value="" size="50" required>*povinné - Vaše meno (objednávateľ)<br>
<input type="submit" value="SEND">
</form>

example.php

<?php
$to = '[email protected]';
$subject = 'FORM';
$message = $_POST['name'];  

mail($to, $subject, $message);
?>

Name is: <?php echo $_GET["name"]; ?>

After send I received correct email, but Name is: --empty--

Thanks a lot

Upvotes: 1

Views: 803

Answers (1)

rid
rid

Reputation: 63590

You can use the $_REQUEST superglobal, which contains everything $_GET, $_POST and $_COOKIE contain.

Upvotes: 4

Related Questions