https://teratail.com/questions/80479
の続きです。べつの質問なので、もう一つ質問を立てました。
無事メールが飛びました。ありがとうございました。
さて、メールがとんできたら、
項目A: Array
項目B: Array
と表示されていました。
sendmail.phpを動かすと、
php
1Notice: Array to string conversion in /var/www/html/lp/sendmail.php on line 32 2 3Notice: Array to string conversion in /var/www/html/lp/sendmail.php on line 32
と表示されました。
連想配列からデータが取り出されていないことになります。
そこで、
php
1<?php 2省略 3$hogeA = $_SESSION['hogeA']; 4$hogeB = $_SESSION['hogeB']; 5省略 6$sendgrid = new SendGrid($api_key, array("turn_off_ssl_verification" => true)); 7$email = new SendGrid\Email(); 8$email->setSmtpapiTos($tos)-> 9 setFrom($from)-> 10 setFromName("送信者名")-> 11 setSubject("[申し込みが来ました] %fullname%さんから申し込みが来ました")-> 12 setText("%fullname%さん \r\n $hogeA, $hogeB")-> <- 13 setSubstitution('%fullname%', '$fullname')-> 14?>
と書くと上記のエラーがでますし、
php
1$sendgrid = new SendGrid($api_key, array("turn_off_ssl_verification" => true)); 2$email = new SendGrid\Email(); 3$email->setSmtpapiTos($tos)-> 4 setFrom($from)-> 5 setFromName("送信者名")-> 6 setSubject("[申し込みが来ました] $fullnameさんから申し込みが来ました")-> 7 setText("$fullnameさん \r\n $hogeA[], $hogeB[]")-> <- 8?>
と書くと、認識できないとエラーが出ます。また、 addSubstitutionを使って配列からとりだそうとしてもエラーになります。
confirm.phpから渡された配列からArrayの正しい値を取り出す書き方を教えてください。
ちなみに、hogeAはチェックボックで選択した物、hogeBはラジオボタンで選択したものです。
よろしくお願いします。
HTMLを追加
HTML
1 <h2>お持ちのhogeAを選択してください。</h2> 2 <div class="ui checkbox"> 3 <input type="checkbox" name="hogeA[]" id="hogeA1" value="hogeshi1" checked="checked"> 4 <label for="license1" class="step-margin">hogeshi1</label> 5 </div> 6 <div class="ui checkbox"> 7 <input type="checkbox" name="hogeA[]" id="hogeA2" value="hogeshi2"> 8 <label for="hogeA2" class="step-margin">hogeshi2</label> 9 </div> 10 <div class="ui checkbox"> 11 <input type="checkbox" name="hogeA[]" id="hogeA3" value="hogeshi3"> 12 <label for="hogeA3" class="step-margin">hogeshi3</label> 13 </div> 14 15 <h2>hogeBを選択してください。</h2> 16 <div class="ui radio checkbox"> 17 <input type="radio" name="hogeB[]" id="hogeB1" value="hogejiki1" checked="checked"> 18 <label for="hogeB1" class="step-margin">hogejiki1</label> 19 </div> 20 <div class="ui radio checkbox"> 21 <input type="radio" name="hogeB[]" id="hogeB2" value="hoegjiki2"> 22 <label for="hogeB2" class="step-margin">hogejiki2</label> 23 </div> 24 <div class="ui radio checkbox"> 25 <input type="radio" name="hogeB[]" id="hogeB3" value="hogejiki3"> 26 <label for="hogeB3" class="step-margin">hogejiki3</label> 27 </div>
CSSはSemantic-uiを一分使っています。
回答3件
あなたの回答
tips
プレビュー