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.
Sign In
Not a member yet? Click here to register.
Forgot Password?
Navigation

Why Am I Getting This Error?

Last updated on 2 years ago
G
GrimlochSenior Member
Posted 2 years ago
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']));
Energy can neither be created nor destroyed; only transformed !
Edited by Grimloch on 20-01-2023 20:05, 2 years ago
D
douwe_yntemaSenior Member
Posted 2 years ago
Check with var_dump the $POST var.
I
And maybe ad an id to the select in stead of a name only
G
GrimlochSenior Member
Posted 2 years ago

douwe_yntema wrote:

@douwe_yntema - Check with var_dump the $POST var.
I
And maybe ad an id to the select in stead of a name only

I added more of my code. Please check it now.
Energy can neither be created nor destroyed; only transformed !
G
GrimlochSenior Member
Posted 2 years ago
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'] : "";
Energy can neither be created nor destroyed; only transformed !
C
ChanSuper Admin
Posted 2 years ago
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 16:04, 2 years ago
G
GrimlochSenior Member
Posted 2 years ago
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 17:50, 2 years ago
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
You cannot set up a bounty in this discussion thread.
Moderator: Support Team
Users who participated in discussion: Chan, Grimloch, douwe_yntema