I'll be thrilled with any solution that will do that. Here's what I've been trying:
I have an input form that gets variable info. I want to email using php mail(), the variable info that was input. I've put the php mail() later in the same html/php file (I haven't used js in here at all). I can't figure out how to access those input variable values, to put into the mail() function.
<form target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <br>
Donation Amount $: <input type="text" name="amount" size="20"> <br>
Instructions to us:
<textarea name="eventcardinstructions" rows=6 cols=60></textarea><br>
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_SM.gif" border="0" name="submit">
etc.
</form> <!-- closes the form and lets the user hit a submit button-->
This is collecting inputs from the user to send to paypal. It's working. The user inputs an amount into an input field and instructions into a textarea. The amount is sent to paypal. The textarea instructions ARE NOT SENT to paypal, which is what I want.
Later (before the form ends OR) after end of form and the submit button that sends this to paypal, I want to reference the "amount" and "instructions" in php mail() function. The mail() function is working and sends emails. It just ignores and doesn't send the variable amounts. So the emails say:
Subjectline: Event Card
Body contents: Event card bought for
The mail function is:
<?php
// headers allow the email to recognize html with in the
// message & process it.
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$eventcardmsg = "Event card bought for " . $_POST['amount'];
$eventcardmsg = $eventcardmsg .= $_POST['eventcardinstructions'];
mail("email@ourdomain.net", "Event Card", $eventcardmsg, $headers);
?>
How do I setup amount and eventcardinstructions so the values are used?
I see a couple related q&as but can't figure it out from them. This answer is using it the same way I am by using the $_POST['variable']; but it's not working for me. https://stackoverflow.com/questions/30016669/how-do-you-save-a-inputs-value-in-a-variable
This one: Assign input form to a variable looks like it's using php in the middle of the html input form to set the variable. I could try that, but seems odd to need to, like I'm not understanding something.
Thanks!!