php Processwire表格

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Processwire表格相关的知识,希望对你有一定的参考价值。

<?php

// Process Form
if($input->post->submit) {
    
    if($session->CSRF->hasValidToken()) {
        
        // form submission is valid
        // okay to process
        
    	// honeypot
        $honeypot = $input->post->honeypot;
        
        if(empty($honeypot)) {
        	
			// email
			$email_to       = "kreativan@outlook.com";
			$email_subject  = "Test Email";
			$email_from     = "example@email.com";
			$email_body     = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit...</p>";
			
			// Include Template
			// if you want to send email template jsut use $email_template instead of $email_body
            ob_start();
            include('email.php');
            $email_template = ob_get_clean();
        	
        	// send email
    		mail("$email_to", "$email_subject", "$email_body", "From: $email_from\nContent-Type: text/html");
        }
        
    } else {
        
		// form submission is NOT valid
		throw new WireException('CSRF check failed!');
        
    }
        
    // Reset token
    $session->CSRF->resetToken();
    
}

?>

<form action="./" method="POST">
  
    <?php echo $session->CSRF->renderInput(); ?>
    
    <input class="uk-hidden" type="email" name="honeypot" />
   
    <input type="submit" name="submit" value="Submit" > 
    
</form>

以上是关于php Processwire表格的主要内容,如果未能解决你的问题,请参考以下文章

php Processwire clean-files.php

php ProcessWire Mail

php ProcessWire管理数据表

php Processwire更改页面创建日期

php Processwire页面URL挂钩

php Processwire Google Analytics跟踪