Help setting variable as previous form input

This code http://codepad.org/qHt2XK4e is a form page. When the fields are complete, it creates a page with the inputted information which is displayed by this code http://codepad.org/2O7ut6rV

On that second page, there is a form at the bottom. It is a php email form and I want to make that form email to the email address provided by the first form page. I thought if I did this
[php]$to = get_post_meta($post->ID, “ema”, true);

it would work as desired since if I put this
[php]<?php if( get_post_meta($post->ID, "ema", true) ): ?>

<?php echo get_post_meta($post->ID, "ema", true); ?> <?php endif; ?>[/php]

in the body of the second page the email address provided on the first would be printed, but it doesnt work it gives me the “Mail could not be sent. Sorry! An error has occurred, please report this to the website administrator.” error when I press submit. I’m betting this is because the email is not getting passed through and not being recognized.

If I change $to to equal an email address like
[php]$to = "[email protected]";[/php]
the email form works perfectly.

All I want to do is have $to equal the value that was inputted by the user into $email1 (and yes, I have tried
[php]$to = $email1;[/php]
but it still displays the error message when I try to submit the email.

If anyone can please help me fix this problem I will greatly appreciate it! Thanks

I will pay $40 paypal immediatly to the person who gives me a working fix. Thanks!

Try this part on your second page, specifically the line where the email1 value is set.

[php]
function process_form() {
// Read POST request params into global vars
// FILL IN YOUR EMAIL
$to = trim($_POST[‘email1’]);
$subject = “JOB APPLICATION from GameChangers500”;
$namefrom = trim($_POST[‘namefrom’]);
$company = trim($_POST[‘company’]);
[/php]

I’ve already tried that. Here is a list of things I have tried that have failed:
http://www.php-forum.com/phpforum/viewtopic.php?f=2&t=19552

Also please understand I do not need that email to be stored in wordpress. If there is an easier way to just send the email along from the first form to be called in the second forms variable then you will still get paid, I mean i really dont care how it does it just as long as it works

You might want to do an ‘echo $_POST[‘email1’]’ and verify the data you expect is the data you are getting. I’ve pulled my hair out looking for errors in my code only to find hours later, the data I assumed I was getting wasn’t what I was getting.

You might want to some checking to verify the string has a @ and a . in it. This is minimal validation but in most cases enough. Every email address has to contain those characters.

Sponsor our Newsletter | Privacy Policy | Terms of Service