いつもお世話になっております。
文字制限をかけたフォームを相手から自分に送信させるためのフォームを作りたいと思っています。出来れば文字制限ではなく、ワード制限をかけたいのですが、どこを探してもワード制限をかけるというのは見ないので、そういう機能は無いのかなと諦めています。
それよりも、入力したフォームが自分に送信されることが重要なのですが、迷惑メールにも入っておらず、何も音沙汰がありません。何がいけないのでしょうか。
php
1<?php 2 /* Program name: form_input.inc */ 3 4$labels = array( "first_name" => "Name:", 5 "email" => "Email:"); 6$translation = array("translation" => "Translation:"); 7 8 $time = date("Y, n, j, Ah:i"); 9 print($time); 10 11mb_language("uni"); 12mb_internal_encoding('utf-8'); 13 14$submit = "Submit"; 15?> 16<html> 17<head> 18 <style type='text/css'> 19 <!-- 20 form { 21 margin: 1.5em 0 0 0; 22 padding: 0; 23 } 24 .field {padding-bottom: 1em;} 25 label { 26 font-weight: bold; 27 float: left; 28 width: 20%; 29 margin-right: 1em; 30 text-align: right; 31 } 32 #submit { 33 margin-left: 35%; 34 } 35 --> 36 </style> 37</head> 38<body> 39<h2>Por favor escribes aqui para traducir.</h2> 40<?php 41 /* loop that displays the form */ 42 echo "<form action='confirm.php' method='post'>"; 43 foreach($labels as $field => $label) 44 { 45 echo "<div class='field'><label for='$field'>$label</label> 46 <input id='$field' name='$field' type='text' 47 size='50%' maxlength='65' /></div>\n"; 48 } 49 foreach($translation as $field => $label) 50 { 51 echo "<div class='field'><label for='$field'>$label</label> 52 <textarea id='$field' name='$field' type='text' 53 size='50%' maxlength='2000' cols='80' rows='50'/></textarea></div>\n"; 54 } 55 ?> 56 <h2>Por favor escoge uno que numero de pagina ahora.</h2> 57<input type="radio" name="page" value="1">1 58<input type="radio" name="page" value="2">2 59<input type="radio" name="page" value="3">3 60<input type="radio" name="page" value="4">4 61<input type="radio" name="page" value="5">5 62<input type="radio" name="page" value="6">6 63<br><br> 64 65 <?php 66 67 echo "<div id='submit'> 68 <input type='submit' value='$submit'></div>"; 69 70 71 ?> 72</form> 73</body> 74</html>
php
1<?php 2 /* Program name: confirm.php */ 3session_start(); 4 5 // after click the button on the Form... 6 if ($_SERVER["REQUEST_METHOD"] == "POST") { 7 // Data come from Form 8 $first_name = htmlspecialchars($_POST['first_name'], ENT_QUOTES); 9 $email = htmlspecialchars($_POST['email'], ENT_QUOTES); 10 $translation = htmlspecialchars($_POST['translation'], ENT_QUOTES); 11 $page = htmlspecialchars($_POST['page'], ENT_QUOTES); 12 } 13 14//Send mail 15$message = "First name:" . $_POST["first_name"] . "\n 16Email:" . $_POST["email"]."\n 17Translation:" . $_POST["translation"]; 18 19if (mb_send_mail("xxxxxxxx@gmail.com", "テストメール", "これはテストです。", "From: xxxxxxxx@gmail.com")) { 20 echo "Sent your email."; 21} else { 22 echo "Something wrong........."; 23} 24 25 // After Submit 26 if (isset($_POST["submit"])) { 27 //when Submit... 28 29 // display thanks 30 header("Location: thanks.php"); 31 exit; 32 } 33?> 34<html lang="uni"> 35<head> 36<meta charset="UTF-8"> 37<title>Inquiry form</title> 38<link rel="stylesheet" href="custom.css"> 39<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.--> 40<script>var __adobewebfontsappname__="dreamweaver"</script> 41<script src="http://use.edgefonts.net/arizonia:n4:default;aladin:n4:default;bad-script:n4:default;french-canon:n4:default.js" type="text/javascript"></script> 42</head> 43<body> 44<div><h1>ABC Company</h1></div> 45<div> 46 <form action="confirm.php" method="post"> 47 <input type="hidden" name="first_name" value="<?php echo $first_name; ?>"> 48 <input type="hidden" name="email" value="<?php echo $email; ?>"> 49 <input type="hidden" name="translation" value="<?php echo $translation; ?>"> 50 <input type="hidden" name="page" value="<?php echo $page; ?>"> 51 <h2>Confirm your inquiry</h2> 52 <p>Please confirm all your information.<br>If it is ok, please click the "Send" button.</p> 53 <div> 54 <div> 55 <p><?php echo ('First name : ' . htmlspecialchars($_REQUEST['first_name'] , ENT_QUOTES).'');?></p> 56 </div> 57 <div> 58 <p><?php echo ('Email Address : ' . htmlspecialchars($_REQUEST['email'] , ENT_QUOTES).'');?></p> 59 </div> 60 <div> 61 <p><?php echo ('Translation : ' . htmlspecialchars($_REQUEST['translation'] , ENT_QUOTES).'');?></p> 62 </div> 63 <div> 64 <p><?php echo ('Page : ' . htmlspecialchars($_REQUEST['page'] , ENT_QUOTES).'');?></p> 65 </div> 66 </div> 67 <input type="button" value="back" onclick="history.back(-1)"> 68 <button type="submit" name="submit">Send</button> 69 70 </form> 71</div> 72</body> 73</html>