概念:
寫入csv檔、寄送email我選擇使用ajax到php來實現,各位也可以試著使用javaScript做。
程式碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>form.html</title>
</head>
<body>
<h1>Basic Information</h1>
<hr>
<form action="saveAndSend.php" method="post" name="info">
<label for="name">NAME:</label>
<br>
<input type="text" name="name" placeholder="輸入姓名" required autofocus/>
<br>
<label for="tel">Tel:</label>
<br>
<input type="tel" name="tel" />
<br>
<label for="birthday">Birthday:</label>
<br>
<input type="date" name="birthday" />
<br>
<label for="email">EMail:</label>
<br>
<input type="email" name="email" placeholder="@gmail.com" />
<br>
<label for="address">Address:</label>
<br>
<input type="text" name="address" size="50"/>
<br>
<br>
<input type="submit" />
<input type="reset" />
</form>
</body>
</html>