2013-04-29 82 views
-2

我剛剛爲joomla 2.5創建了一個模塊計算器。我想通過用戶輸入的信息發送到電子郵件地址用joomla 2.5的電子郵件發送數據值?

<div class="formRow"> 
<label id="jform_varListCarburant-lbl" for="jform_varListCarburant" class=""><?php echo JText::_("MOD_MODULESCASCODEVIS_EN_LIGNE_VARLISTCARBURANT"); ?></label> 
<select id="jform_varListCarburant" name="jform[varListCarburant]" class=""> 
    <option value="0" selected="selected" <?php if($varListCarburant=="0") echo "selected=\"selected\"" ?>><?php echo JText::_("Choisir"); ?></option> 
    <option <?php if($varListCarburant=="1") echo "selected=\"selected\"" ?> value="1">Essence</option> 
    <option <?php if($varListCarburant=="2") echo "selected=\"selected\"" ?> value="2">Diesel</option> 
</select> 

</div> 

變量計算器:

$varListCarburant = isset($form["varListCarburant"]) ? $form["varListCarburant"] : ""; 

$varListCarburant = preg_replace('/[^0-9.\-]/', '', str_replace(',', '.', $varListCarburant)); 

$varListPuissance = isset($form["varListPuissance"]) ? $form["varListPuissance"] : ""; 

$varListPuissance = preg_replace('/[^0-9.\-]/', '', str_replace(',', '.', $varListPuissance)); 

$varListUsage = isset($form["varListUsage"]) ? $form["varListUsage"] : ""; 

$varListUsage = preg_replace('/[^0-9.\-]/', '', str_replace(',', '.', $varListUsage)); 

$varListEtatvoiture = isset($form["varListEtatvoiture"]) ? $form["varListEtatvoiture"] : ""; 

$varListEtatvoiture = preg_replace('/[^0-9.\-]/', '', str_replace(',', '.', $varListEtatvoiture)); 
+0

歡迎SO和感謝分享這個美妙的想法..,雖然這個職位被拒絕投票並可能關閉,請去[FAQ](http://stackoverflow.com/faq)閱讀。 – dbf 2013-04-29 18:48:57

+1

請閱讀本文,請:http://stackoverflow.com/a/16278454/632407 – kobame 2013-04-29 18:58:15

回答

0
$mailer = JFactory::getMailer(); 
     $mailer->setSender(array($fromemail, 'Your mail text')); 
     $mailer->addRecipient($toemail); 
     $mailer->setSubject($subject); 
     $mailer->setBody($body); 
     $mailer->IsHTML(false); 
     $mailer->Send();