PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Jan 16, 2018 6:08 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Sep 10, 2009 3:08 pm 
Offline
Forum Newbie

Joined: Thu Sep 10, 2009 3:02 pm
Posts: 2
Hello
I'm having trouble with $_POST and using the variables my uisers generate in a flash application. Using php outside of Swift Mailer I was able to successfully make this happen. Is there a syntax that I'm not getting here.

I'm using this for the setTo() header: $_POST["email2"];
&
I'm using this in the html setbody():
'Your Contact name is: -------------- <b>{$_POST["contact2"]}</b><br>'.
'Your Email is: --------------------- <b>{$_POST["email2"]}</b><br>'.
'Your Cell Number is: --------------- <b>{$_POST["cell2"]}</b><br>'.
'Your Zip Code is: ------------------ <b>{$_POST["zip2"]}</b><br>'.

Thanks for any help or direction.
a


Top
 Profile  
 
PostPosted: Thu Sep 10, 2009 8:08 pm 
Offline
Site Admin
User avatar

Joined: Tue Dec 23, 2003 3:10 am
Posts: 11470
Location: Toronto
When evaluating arrays inside curly brackets, you need to omit the quotes around the keys, i.e.,

Syntax: [ Download ] [ Hide ]
'Your Contact name is: -------------- <b>{$_POST[contact2]}</b><br>'.
'Your Email is: --------------------- <b>{$_POST[email2]}</b><br>'.
'Your Cell Number is: --------------- <b>{$_POST[cell2]}</b><br>'.
'Your Zip Code is: ------------------ <b>{$_POST[zip2]}</b><br>'.


Top
 Profile  
 
PostPosted: Fri Sep 11, 2009 11:24 am 
Offline
Forum Newbie

Joined: Thu Sep 10, 2009 3:02 pm
Posts: 2
John
Thanks for the reply and sorry for the breach in protocol. I'm having issues with the "->setTo()" line in my code. Is it not in proper format to get $_POST from flash? I have tried it several different ways, but with no success:

Syntax: [ Download ] [ Hide ]
<?php
 
session_start();
$ses_id = session_id();
$prodID = $ses_id . ".jpg";
 
require_once 'lib/swift_required.php';
 
$smtp = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($smtp);
 
$message = Swift_Message::newInstance('Maverik Lacrosse Customizer Retailer Product details');
$message
->setTo = $_POST['email2'];
->setFrom(array('custom@company.com' => 'Customer Name'))
->setBcc(array('me_@blah.com' => 'MyName'))
 
->setBody(
'<html>'.
'<table width="800" cellspacing="0" cellpadding="0">'.
'<body>'.
'<tr>'.
'<td style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 150%; color: black">
<meta http-equiv="Content-Type" content="text/html;charset= utf-8;">'
.
'<b>Your Product Details</b><br>'.
'--------------------------------------------------------------------------------------------------------<br>'.
'Your Contact name is: -------------- <b>{$_POST[contact2]}</b><br>'.
'Your Email is: --------------------- <b>{$_POST[email2]}</b><br>'.
'Your Cell Number is: --------------- <b>{$_POST[cell2]}</b><br>'.
'Your Zip Code is: ------------------ <b>{$_POST[zip2]}</b><br>'.
'--------------------------------------------------------------------------------------------------------<br>'.
'<br>'.
'Thank you for visiting the customers site.<br>'.
'One of our sales representatives will contact you shortly to confirm your order.<br>'.
'<br>'.
'<b>Please remember that:</b><br>'.
'<b>1)</b> Our delivery time is based on availability<br>'.
'<b>2)</b> The product colors cannot match exactly to the screen values<br>'.
'<b>3)</b> Your logo art needs to be camera ready or in digital form.<br>'.
'<br>'.
'<b>Here is the product you designed:</b><br>'.
'--------------------------------------------------------------------------------------------------------<br>'.
'<br>'.
'<img src="' . $message->embed(Swift_Image::fromPath($prodID)) . '" />'.
'</p>'.
'</td>'.
'</tr>'.
'</body>'.
'</table>'.
'</html>', 'text/html')
 
->addPart(
'--------------------------------------------------------------------------------------------------------
Your Contact name is: -------------- {$_POST["contact2"]}
Your Email is: --------------------- {$_POST["email2"]}
Your Cell Number is: --------------- {$_POST["cell2"]}
Your Zip Code is: ------------------ {$_POST["zip2"]}
--------------------------------------------------------------------------------------------------------
           
Thank you for visiting the Customizer site. One of our sales representatives will
contact you shortly to confirm your order.
 
Please remember that:
1) Our delivery time is based on availability
2) The product colors cannot match exactly to the screen values
3) Your logo art needs to be camera ready or in digital form.
--------------------------------------------------------------------------------------------------------'
, 'text/plain')
;
//Send the message
$mailer->send($message);
?>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group