2017-03-03 47 views
0

我沒有寫這段代碼,但我希望能夠將我的表單的名字添加到主題行以及隨機變量中。代碼我從 HTML-FORM-GUIDE.com得到,因爲我不知道基本html以外的代碼。我也想有一個CC去發件人。我不確定你是否需要比我粘貼的代碼更多的代碼。我不知道如何添加變量$ this-> first_name以及rand(11,999)並讓它們顯示在主題行中。在主題行中添加其他變量

表單區域:

<label for='first_name' >First Name*: </label> 
<input type='text' name='first_name' id='first_name' value='<?php echo $formproc->SafeDisplay('first_name') ?>' maxlength="60" /> <br/> 
<span id='contactus_name_errorloc' class='error'></span> 

PHP代碼區(目標是有主題解讀爲第一個請求,名稱&隨機碼)

 function SendFormSubmission() 
{ 
    $this->CollectConditionalReceipients(); 
    $this->mailer->CharSet = 'utf-8';  
    $this->mailer->Subject = "Request from $this->name" ; 

對於電子郵件接收者的代碼如下所示:

$formproc->AddRecipient('[email protected]'); 

表單域:

<label for='email' >Email*:</label></td> 
    <td><input type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="60" /> 

回答

1

請試試這個:

function SendFormSubmission(){ 
    $this->CollectConditionalReceipients(); 
    $this->mailer->CharSet = 'utf-8'; 
    // Concat string with random number 
    $this->mailer->Subject = "Request from $this->name"." with random number :".rand(11,999) ; 
    // Add CC 
    $this->mailer->AddCC($senderEmail); 
    . 
    . 
    .