www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to display multiple data in html file using php

  1. #1
    Join Date
    Jul 2009
    Posts
    138

    Smile 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@email.com");
    $emailObj->setTo("email@email.com");
    $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

  2. #2
    Join Date
    Jun 2005
    Location
    Fullerton, CA USA
    Posts
    61
    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.

  3. #3
    Join Date
    Jul 2009
    Posts
    138

    Really complicated

    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 ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles