Hey Net Girl,
I know Chris got you up and running with his solution, but if you want to give this a shot again it should produce the desired results you're looking for - which includes the SKU. I actually tested this out on a set of NEWS record set up as a section editor "Multi" which is what I believe you're using for your products. Obviously, you';; need to edit the header calls to your CMS Builder and calls to your records as needed,
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
// // load viewer library
// $libraryPath = 'cmsbuilder/lib/viewer_functions.php';
// $dirsToCheck = array('/home/content/blabla/blablabla/html/','','../','../../','../../../');
// foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
// if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
// your CMS Builder record data goes in here
// load records from 'products'
list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'perPage' => '4',
'loadUploads' => true,
//'allowSearch' => false,
'orderBy' => 'date DESC',
//'orderBy' => 'date ASC',
));
// load records from 'products'
list($productsDDRecords, $productsDDMetaData) = getRecords(array(
'tableName' => 'products',
//'perPage' => '4',
//'loadUploads' => true,
//'allowSearch' => false,
'orderBy' => 'date DESC',
//'orderBy' => 'date ASC',
));
?>
<?php
// process form
if (@$_REQUEST['submitForm']) {
// error checking
$errorsAlerts = "";
if (!@$_REQUEST['name']) { $errorsAlerts .= "Please enter your name!<br/>\n"; }
if (!@$_REQUEST['telephone']) { $errorsAlerts .= "Please enter your phone number!<br/>\n"; }
if (!@$_REQUEST['email']) { $errorsAlerts .= "Please enter your email!<br/>\n"; } else if(!isValidEmail(@$_REQUEST['email'])) { $errorsAlerts .= "Please enter a valid email (example: user@example.com)<br/>\n"; }
if (!@$_REQUEST['product']) { $errorsAlerts .= "Please select a product!<br/>\n"; }
if (!@$_REQUEST['message']) { $errorsAlerts .= "Please enter a message!<br/>\n"; }
else {
// Process the form like normal
}
// send email user
if (!$errorsAlerts) {
$from = $_REQUEST['email'];
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .="From: $from \r\n";
$to = "patricia@thenetgirl.com"; // ENTER YOUR EMAIL ADDRESS HERE
$subject = "Product Inquiry";
$message = <<<__TEXT__
<div style='padding:24px; font-size:14px; font-family:Arial; color:#333333; border:#333333 solid 1px;'>
<strong>Name:</strong> {$_REQUEST['name']}<br />
<strong>Phone Number:</strong> {$_REQUEST['telephone']}<br />
<strong>Email:</strong> {$_REQUEST['email']}<br /><br />
{$_REQUEST['product']}<br /><br />
<strong>Message:</strong> {$_REQUEST['message']}<br /><br />
</div>
__TEXT__;
// send message
$mailResult = @mail($to, $subject, $message, $headers);
if (!$mailResult) { die("Mail Error: $php_errormsg"); }
//
$errorsAlerts = "Thank you for contacting us. We will be in touch with you very soon.";
$_REQUEST = array(); // clear form values
}
} // contact form - end process form
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Simple Contact Form</title>
</head>
<body>
<div style="width:600px;">
<form method="POST" action="">
<input type="hidden" name="submitForm" value="1" />
<?php if (@$errorsAlerts): ?>
<p style="color:#990000; font-size:14px; font-weight:bold; font-family:Verdana;"><?php echo $errorsAlerts; ?><br /></p>
<?php endif ?>
<div><div style="width:100px; float:left;">
<label for="name" style="font-size:14px; font-weight:bold; font-family:Verdana; margin-right:6px;">Name</label></div>
<input type="text" name="name" size="32" value="<?php echo htmlspecialchars(@$_REQUEST['name']); ?>"/></div> <div style="clear:both"></div>
<div><div style="width:100px; float:left; margin-top:6px;">
<label for="email" style="font-size:14px; font-weight:bold; font-family:Verdana; margin-right:6px;">Email</label></div>
<input type="text" name="email" size="32" value="<?php echo htmlspecialchars(@$_REQUEST['email']); ?>"/></div> <div style="clear:both"></div>
<div><div style="width:100px; float:left; margin-top:6px;">
<label for="telephone" style="font-size:14px; font-weight:bold; font-family:Verdana; margin-right:6px;">Phone</label></div>
<input type="text" name="telephone" size="32" value="<?php echo htmlspecialchars(@$_REQUEST['telephone']); ?>"/></div> <div style="clear:both"></div>
<div><div style="width:100px; float:left; margin-top:6px;">
<label for="product" style="font-size:14px; font-weight:bold; font-family:Verdana; margin-right:6px;">Product</label></div>
<select name="product">
<option value="">Select Product Name</option>
<?php foreach ($productsDDRecords as $record): ?>
<option value="<strong>SKU:</strong> <?php echo $record['product_id_sku']; ?> <strong>Product Title:</strong> <?php echo $record['title']; ?>" <?php selectedIf($record['title']) ?> ><?php echo $record['title']; ?></option>
<?php endforeach ?>
</select>
</div> <div style="clear:both"></div>
<div><div style="width:100px; float:left; margin-top:6px;">
<label for="message" style="font-size:14px; font-weight:bold; font-family:Verdana; margin-right:6px;">Message</label></div>
<textarea name="message" rows="4" cols="30" style="border:#532314 solid 1px; padding:6px; color:#000;"><?php echo htmlspecialchars(@$_REQUEST['message']); ?></textarea></div> <div style="clear:both"></div>
<input type="submit" name="submit" value="Send Message" style="margin-left:100px; margin-top:6px;" />
</form>
</div>
</body>
</html>