I have a newsletter form in my wordpress site which supposed to be used through the shortcode :
<form action="newsletter.php" method="post">
...
</form>
And the shortcode should look :
[newsletter]
In my theme option i have an input field to enter the email address. That value needs to be stored in newsletter.php in the variable $to
How can i 'connect' the newsletter.php with the wordpress get_option for that input i have?
newsletter.php :
<?php
$email = $_POST['news'];
// --- this should be the option from the wordpress panel -------
$to = "[email protected]";
// ---------------------------------
$subject = "newsletter request";
$date = date("d-m-Y");
$email_message = " Newsletter request : \r\n";
$email_message .= " ================================================== \r\n ";
$email_message .= "This user wants to be notified about your website launch : ".$email."\r\n";
$email_message .= " ================================================== \r\n";
$email_message .= " Request was sent " .$date. " \r\n";
$headers = 'From: '.$email."\r\n";
if($email != null && $email != ""){
mail($to,$subject,$email_message,$headers);
}
header("location:../index.php");
?>
I tried with REQUIRE_ONCE but, that isn't working...