I think most of the kinks have been worked out, but I have one last remaining issue. How can I capture values using a form's input tag?
I attempted to use this based on a wild guess:
<input type="hidden" name="email" value="<?php $name = $_REQUEST["email"]; ?>">
...together with my second form but I didn't have much luck capturing the values from the first form. As a result, once I pressed the confirm button on the form, the script sent me a blank email without any of the information I wanted.
I'm fairly certain there's a way to pass along form values from one HTML form to another, but for the life of me I can't recall the syntax. Is there an equivalent PHP statement/expression/etc I can use instead, or a proper way to assign non hardcoded values to input tags using PHP?
To explain in more detail, currently I first capture the data from the first form using:
$email = $_REQUEST["email"];
...then I use div tags to form a table with the info lined up:
<div class="left">
<p>email</p>
</div>
<div class="right">
<p>
<?php
echo $email;
?>
</p>
</div>
... and then I display a form:
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="email" value="<?php $name = $_REQUEST["email"]; ?>">
<input type="submit" name="confirm" value="Confirm" />
</form>
... where pressing confirm is supposed to send the values from that new form back to the same PHP page, where the "confirm value will activate the second if expression.
<?php
if(isset($_REQUEST['confirm'])){
$email = $_REQUEST["email"];
?>
<div class="left">
<p>email</p>
</div>
<div class="right">
<p>
<?php
echo $email;
?>
</p>
</div>
<?php
$headers = "From: $email";
mail($to, $subject, $message, $headers);
echo "Your message has been sent.";
}
?>