/    Sign up×
Community /Pin to ProfileBookmark

How to display multiple data in html file using php

Dear user,

does any one know how to display multiple records in HTML file using PHP ?
Here we go the input fields generating names title_

<label for=”title_<?php echo $cnt1; ?>”>Title:</label></td>
<td><input type=”text” name=”title_
<?php echo $cnt1; ?>” id=”title_<?php echo $cnt1; ?>” value=”<?php echo KT_escapeAttribute($row_rsarticles[‘title’]); ?>” size=”32″ />
</td>

So it’s title_1, title_2 … deppends how many I wnat to display

But when I am trying to send using this code

function Trigger_SendEmail(&$tNG) {
$emailObj = new tNG_Email($tNG);
$emailObj->setFrom(“[email protected]“);
$emailObj->setTo(“[email protected]“);
$emailObj->setCC(“”);
$emailObj->setBCC(“”);
$emailObj->setSubject(“Test Newsletter”);
//FromFile method
$emailObj->setContentFile(“newsletter.htm”);
$emailObj->setEncoding(“ISO-8859-1”);
$emailObj->setFormat(“HTML/Text”);
$emailObj->setImportance(“Normal”);
return $emailObj->Execute();

The newsletter.htm file does not repsond for the {title_1}, {title_2}….
only for {title} and it’s sending 4 emails instead of one if I have 4 fields…

Thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@proutonJul 21.2010 — The first piece of code appears to be part of building an HTML form.

The second piece of code creates an email using "newsletter.htm" as the body of the email.

If the first piece of code is in "newsletter.htm", then it's not going to be executed until someone receives and views the email, at which point it's too late to be reading your database.

But it sounds like you're executing the second piece of code for each record you retrieve. You don't want to do that. You need to execute the code that builds the email content as if you were building a dynamic webpage (which you would be), and by the time you call the second piece of code the "newsletter.htm" file needs to be finished and closed. DON'T execute (i.e. load in a browser) the "newsletter.htm" file. Create "newsletter.htm" from some other page or process.

While it's possible to create a form in an email body, that generally isn't how you want to be doing it. Create links in the email body back to your website, passing parameters in the URL for your page to act upon.
Copy linkTweet thisAlerts:
@spacemocauthorJul 21.2010 — I tryed many different ways and the result it's still the same, it's must be the lack of knowlegde !!! ? can I get in touch with you so you can help me a little ?
×

Success!

Help @spacemoc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...