I'd like to send the user a copy of the contact form that they submit. I've got this php code:
$formproc->AddRecipient('webmaster@somewhere.com');
and this front-end code:
<form id='contactsensei' action='<?php echo $formproc->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
<fieldset>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>' value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
<input type='text' class='spmhidip' name='<?php echo $formproc->GetSpamTrapInputName(); ?>' />
<div class='container'>
<label for='email' >*E-mail:</label><br/>
<input type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/>
<span id='contactsensei_email_errorloc' class='error'></span>
</div>
How do I get the e-mail that the user inputs and add it to the recipients address? I get it in theory, get the user input info and put it in a variable so it end's up something like
$uemail = $_POST[uemail];
$formproc->AddRecipient('webmaster@somewhere.com, $useremail');
It's obviously not working. Little help. Thanks.
==
Ugh, thought I fixed it because it works, but apparently it works with errors. I have it now with
$uemail = $_POST['email'];
$formproc->AddRecipient('webmaster@somewhere.com'); //<<---Put your email address here
$formproc->AddRecipient($uemail);
Again it works, but I'm getting this error: Notice: Undefined index: email in C:\wamp64\www\scripts\contact\contactus.php on line 19
which I have not seen before. My functions are coming from a custom fgcontactform.php if that matters. What / where is it asking me to define?
if you want to add it from post try this:
$uemail = $_POST['uemail'];
$formproc->AddRecipient($uemail);
Each parameter separated by the comma.If uemail is not a defined
word then you need to use $_POST['uemail']
.And you need to use quotes like:
$uemail = $_POST['uemail'];
if(isset($uemail))
{
$formproc->AddRecipient($uemail);
}
uemail
is recognized as a constraint, to access the $_POST array you must specify a key as a string and it must be the same as your input name
attribute, so try
$uemail = $_POST['email'];
and finally pass that variable to the AddRecipient method:
$formproc->AddRecipient($uemail);