PDA

View Full Version : Newsletter sender



intro
19 Oct 2010, 8:44 AM
Hi i am making newsletter sender, and i am having problem with sending script:

i post
Newlsetterid59id25id26taskSENDNEWSLETTERand i dont know how to get all ids..

my post script is
if (btn == 'yes') {

var datanewsletter=new Array();

i=0;


Ext.each(selections, function (selection) {
datanewsletter[i] = selection.get('ID');

i=i+1;

}); Ext.Ajax.request({
method: "POST", timeout: 100000,
url: 'NewsletterHTMLDB.php',

params: {

task:"SENDNEWSLETTER",id : datanewsletter,Newlsetterid: record.get('ID')



}

});
Mabe someone have better way?:D

troseberry
19 Oct 2010, 8:48 AM
The Id's of what? What is "selections" ?

intro
19 Oct 2010, 8:57 AM
Newlsetterid59 that is newletter html
id25 and that is id fror e-mail
id26


foreach($_POST['id'] as $key => $value){

echo($value);
if(substr($key,0,3) == 'kat'){
$result = $mail->send(array($value));

}
} but only last id is in $_post

I use htmlMimeMail and $mail->send(array($value)); is mail parametars

troseberry
19 Oct 2010, 9:03 AM
Ok but your not telling us what the problem really is. Are you having issues with the 'NewsletterHTMLDB.php' script? or are you having problems of extracting your data so that you can send it to the php script? Where are these "id's" coming from? Please clarify what your requirement is.

intro
19 Oct 2010, 9:10 AM
when i post data : newsletter id, and e-mail users ID.
I dont know how i can get e-mail ID users $_POST['id'] that i can use in foreach.

Because if i put $_POST['id'] in foreach i get just last sended ID in echo and errors.

I need php script that can get all "id" and foreach use
$result = $mail->send(array($value));.

Thanks in advance..

troseberry
19 Oct 2010, 9:28 AM
So are you getting all the proper data sent to the server using the Ajax.request? And your problem is just parsing issues in php? What does your post data look like?

intro
19 Oct 2010, 9:30 AM
Newlsetterid:59
id:25
id:26
task:SENDNEWSLETTER: are added for better show

it is parsing issues how to pu id's in array or foreach

troseberry
19 Oct 2010, 9:55 AM
What are the errors that your said your getting?

intro
19 Oct 2010, 10:22 AM
Invalid argument supplied for foreach() in <b>/home/introhr/public_html/eska/admin/NewsletterHTMLDB.php</b> on line <b>443</b><br />

troseberry
19 Oct 2010, 10:33 AM
If you
echo($_POST['id']) what does it show? My guess is that your response is one big concat string and not individual fields.

intro
19 Oct 2010, 10:35 AM
just 26

intro
19 Oct 2010, 10:58 AM
If i put in php

$prikaz=array($_POST['id']);
print_r($prikaz);

i get
Array
(
[0] => 26
)



Thanks for helping

intro
20 Oct 2010, 1:27 AM
any help?

intro
20 Oct 2010, 6:18 AM
Hi it is simple thing :) for advanced programers mabe :)

i am having
Source
task=SENDNEWSLETTER&email=vladimir%40intro.hr&email=kasandra%40intro.hr&Newlsetterid=59

How can i get email parametars, because when i use print_r- he show

Array
(
[task] => SENDNEWSLETTER
[email] => [email protected]
[Newlsetterid] => 59
)

but in Post in firebug is


Newlsetterid59email
[email protected]@intro.hrtaskSENDNEWSLETTER

Thanks in advance..