Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Why Am I Getting This Error?

Locked Asked Modified Viewed 1,106 times
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
asked
Senior Member

I keep getting undefined array key errors in my newsletter infusion which I modified to work under Fusion 8.00.80... This is the line that gives the error:
   $send_array = ($_POST['send_to']);
   $list = implode(",",$send_array);
   $to_email = $list;
   $list_array = explode(",",$to_email);
   reset($list_array);

foreach($list_array AS $to_mail) {

This is the actual array line:
// Select site users single/multiple/all send
   echo "<td class='tbl2' valign='top' align='left'><a href='' class='addspeech' title='".$locale['nl_931']."' rel='#speechbubble4'><img src='images/help.gif' border='0' alt='' /></a>&nbsp;<span style='font-size: 17px; font-weight: bold;'>".$locale['nl_464']."</span></td><td class='tbl1' valign='top' align='left'><table cellspacing='0' cellpadding='0' border='0'><tr>n";
   echo "<td valign='top' align='left' width='260'><input type='checkbox' name='delivery' value='um1'".$um1." />".$locale['nl_442']."</td>n";
   echo "<td valign='top' align='center'><select name='send_to[]' multiple='true' size='8' class='textbox' style='width:295px;'>";
   $result = dbquery("SELECT * FROM ".DB_NEWS_LETTER_SUBS." WHERE nl_sub_stat ='1' AND nl_sub_who='1' ORDER BY nl_sub_name");
   if (dbrows($result) != 0) {
   while ($data = dbarray($result)) {
 $selected = (isset($_GET['nl_sub_mail']) && $_GET['nl_sub_mail'] == $data['nl_sub_mail']) ? 'selected="selected"' : '';
 echo "<option value='".$data['nl_sub_mail']."'$selected>".$data['nl_sub_name']." - ".$data['nl_sub_mail']."</option>n";
 }
}
   echo "</select></td></tr></table></td>n";
   echo "</tr><tr>n";
// End select site users single/multiple/all send

Am I doing the $send_array line wrong? Should it be like this?
$send_array = (($_POST['send_to']));
Edited by Grimloch on 20-01-2023 21:05,
0 replies

4 posts

D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

Check with var_dump the $POST var.
I
And maybe ad an id to the select in stead of a name only
1 reply
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

OK. I simply added this to the top of my file and I believe it cured my problem:
$send_to = isset($_REQUEST['send_to']) ? $_REQUEST['send_to'] : "";
0 replies
C
Chan
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
answered
Super Admin

Glad it worked out, but you can try this shorthand as well that bears the same meaning.
$send_to = $_REQUEST['send_to'] ?? "";


The code above is different than an empty check though which goes like this:

$send_to = !empty($_REQUEST['send_to']) ? $_REQUEST['send_to'] : '';
Edited by Chan on 22-01-2023 17:04,
0 replies
G
Grimloch
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
answered
Senior Member

Appreciate your input Chan however, there are 3 send sections (routines) in my newsletter script so I ended up wrapping each section with this:
if(isset($_POST['send_to'])) {
and that seems to work just fine. Better in fact. So now I think I have a very solid newsletter system for Fusion ver8. Should be the same for ver9. With this change I was able to send 100 emails in 105 seconds. Before it would take over 4 minutes.
Edited by Grimloch on 22-01-2023 18:50,
0 replies

Statistics

  • Views 0 views
  • Posts 4 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
Chan 0
Lead Developer of PHP-Fusion
  • Super Admin, joined since
  • Contributed 3,841 posts on the community forums.
  • Started 232 threads in the forums
  • Answered 6 questions
G
G
Energy can neither be created nor destroyed; only transformed !
  • Senior Member, joined since
  • Contributed 722 posts on the community forums.
  • Started 141 threads in the forums
  • Started this discussions
  • Answered 2 questions
D
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet