I am trying to reference the title of the site in a Wordpress mail form. I thought I could just echo but that doesn't appear to work. In other words, I want subject of the mail form to always be "RSVP from [site title here]".
// variables connect with rsvp form
$name = $_POST["rsvpName"];
$email = $_POST["rsvpEmail"];
$attend = $_POST["rsvpAttend"];
$number = $_POST["rsvpNumber"];
$website = '<?php echo bloginfo('name') ?>';
// variables defined for message to admin
$to = get_option('admin_email'); //sending to wordpress admin email
$subject = "RSVP from $website";
$headers = "From: $email";
$message = "$name $attend your invitation.\nNumber of guests in their party:
$number";
Thanks for any help!
Your current code is creating a string with php tags in it. You need to use the get_bloginfo
function:
$website = get_bloginfo('name');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.