<?php if(isset($_POST['submit'])){ $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $to = 'xxxx@xxx.com'; $subject = 'New Form Submission'; $headers = 'From: '.$email; if(mail($to, $subject, $message, $headers)){ echo 'Your message has been sent.'; } else{ echo 'Unable to send email. Please try again.'; } } ?>
<?php $str = "Hello World"; $arr = explode(" ",$str); print_r($arr); ?>
輸出結果:
Array ( [0] => Hello [1] => World )
<?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "myDB"; $conn = mysqli_connect($servername, $username, $password, $dbname); $sql = "SELECT id, firstname, lastname FROM MyGuests"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>"; } } else { echo "0 results"; } mysqli_close($conn); ?>
上一篇ajax 提交model
下一篇css3動態模板