Zen Follower
- Join Date:
- Jan 2011
- Posts:
- 196
- Plugin Contributions:
- 0
Custom Email Form in Product Description
I am trying to create a customer-selectable package deal. Basically the customer can configure their own package deal and send it as an email. So basically, I need to have a radio button and text box form within the product description:
<div itemprop="description" id="productDescription" class="productGeneral biggerText">
</div>
I have tried few custom email forms; however, since they contain php code above the HTML, when I save all of it in the product description, it shows all the PHP code as well as html, rendering it unusable.
Sample HTML Form that I have tried:
<?php
if($_POST["submit"]) {
$recipient="[email protected]";
$subject="Form to email message";
$sender=$_POST["sender"];
$senderEmail=$_POST["senderEmail"];
$message=$_POST["message"];
$mailBody="Name: $sender\nEmail: $senderEmail\n\n$message";
mail($recipient, $subject, $mailBody, "From: $sender <$senderEmail>");
$thankYou="<p>Thank you! Your message has been sent.</p>";
}
?><!DOCTYPE html>
<?=$thankYou ?>
<form method="post" action="contact.php">
<label>Name:</label>
<input name="sender">
<label>Email address:</label>
<input name="senderEmail">
<label>Message:</label>
<textarea rows="5" cols="20" name="message"></textarea>
<input type="submit" name="submit">
</form>
