Emailing when submit button is pressed
问题 <?php echo $this->Form->end(__('Submit')) $to = "someone@hotmail.com"; $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "someonelse@example.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> Hey guys need help here! I want when someone pressed the submit button, it saves and sends the details entered to the emails 回答1: You have to use like this.Make sure your button type is submit <?php if($_POST){ $to = "someone