2014-02-14 72 views
0

我想完成一個表格。問題與PHP表格

我希望有人走下面並填寫信息 t1.html

他們填寫信息後,他們會看到一個三江源提交 (現在它觸及到了他們進入哪一個PHP頁面)

有人會收到一封電子郵件(郵件中的電子郵件地址),其中包含從頁面輸入的php頁面的鏈接。

那個獲得電子郵件的人將接受或拒絕該PHP頁面。

我很想念如何生成php頁面,因此接收電子郵件的人將能夠訪問輸入到表單中的信息。我怎麼做?

形式

<form name="iform" method="post" action="html_form1.php" class="iform"> 

    <ul> 

    <li><label for="SendingeWarrant">Sending to:</label><input class="itext"   type="text" name="SendingeWarrant" id="SendingeWarrant" /></li> 
    <li class="iseparator">&nbsp;</li> 
    <li> 
    <label for="Email">Email Address that the email goes to:</label><input class="itext" type="text" name="Email" id="Email" /> 
    </li> 
    <li class="iseparator">&nbsp;</li> 
    <li><label>&nbsp;</label><input type="Submit" name="Submit" value="Submit" /></li> 
    </ul></form> 

PHP

 <?php 
    if (!empty($_POST)) { 


$success = $error = false; 


$post = new stdClass; 


foreach ($_POST as $key => $val) 
    $post->$key = trim(strip_tags($_POST[$key])); 

// Check for blank fields 
if (empty($post->Email)) 
    $error = true; 

else { 

    // Get this directory, to include other files from 
    $dir = dirname(__FILE__); 

    // Get the contents of the pdf into a variable for later 
    ob_start(); 
    require_once($dir.'/pdf.php'); 
    $pdf_html = ob_get_contents(); 
    ob_end_clean(); 

    // Load the dompdf files 
    require_once($dir.'/dompdf/dompdf_config.inc.php'); 

    $dompdf = new DOMPDF(); // Create new instance of dompdf 
    $dompdf->load_html($pdf_html); // Load the html 
    $dompdf->render(); // Parse the html, convert to PDF 
    $pdf_content = $dompdf->output(); // Put contents of pdf into variable for later 

    // Get the contents of the HTML email into a variable for later 
    ob_start(); 
    require_once($dir.'/html3.php'); 
    $html_message = ob_get_contents(); 
    ob_end_clean(); 

    // Load the SwiftMailer files 
    require_once($dir.'/swift/swift_required.php'); 

    $mailer = new Swift_Mailer(new Swift_MailTransport()); // Create new instance of SwiftMailer 

    $message = Swift_Message::newInstance() 
        ->setSubject('eWarrant') // Message subject 
        ->setTo(array($post->Email => $post- >SendingeWarrant)) // Array of people to send to 
        ->setFrom(array('[email protected]' => 'eWarrant')) // From: 
        ->setBody($html_message, 'text/html'); // Attach that HTML message from earlier 


    // Send the email, and show user message 
    if ($mailer->send($message)) 
     $success = true; 
    else 
     $error = true; 

    } 

     } 
     ?> 


    <html> 
     <head> 
<style> 
body {font-family:Helvetica, Arial, sans-serif; font-size:10pt;} 
table {width:100%; border-collapse:collapse; border:1px solid #CCC;} 
td {padding:5px; border:1px solid #CCC; border-width:1px 0;} 
</style> 
    </head> 
     <body> 

<h1></h1> 

<table> 
    <tr> 
     <td><strong>Name of person sending to:</strong></td> 
     <td><?php echo $_POST["SendingeWarrant"]; ?></td> 
     <td><strong>Email being sent to:</strong></td> 
     <td><?php echo $_POST["Email"]; ?></td> 
    </tr> 
</table> 

<p>Approve/Deny</p> 

    </body> 
    </html> 
    </body> 
    </html> 

電子郵件php文件

<html> 
    <body> 

    <p style="font-family:Helvetica, Arial, sans-serif;font-size:"x-small";"><?php echo $post->SendingeWarrant; ?></p> 
     <p style="font-family:Helvetica, Arial, sans-serif;font-size:"x-small";">Click link to approve or deny: </p> 

    </body> 
     </html> 
+0

你聽說過SQL嗎? – enapupe

+0

聽說過但不熟悉 – user2197436

+0

您應該開始使用sql –

回答

0

輸入數據庫中的電子郵件數據,當人接受電子郵件將點擊接受按鈕,它會從數據庫中獲取這些數據。