hi there,

i have tried numerous fixes on the net but none are working. basically my form sends an email in php script but after the form has been submitted. this works if i physically press the submit button on my page.

i want to have it where it will submit on page load as i will setup a cron job to execute the page daily.

form code and one way i have tried but did not work:

 <form  method="post" id="form1" name="form1" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
    <table cellpadding="2" cellspacing="0" class="KT_tngtable">
        <td class="KT_th"><label for="EmailStatus">EmailStatus:</label></td>
        <td><input type="text" name="EmailStatus" id="EmailStatus" value="<?php echo KT_escapeAttribute($row_rsemail_log['EmailStatus']); ?>" size="32" />
          <?php echo $tNGs->displayFieldHint("EmailStatus");?> <?php echo $tNGs->displayFieldError("email_log", "EmailStatus"); ?></td>
      <tr class="KT_buttons">
        <td colspan="2"><input type="submit" name="KT_Insert1" id="KT_Insert1" value="Insert record" /></td>


Member Avatar


In which case you don't need a form at all.

All the vars you enter into the form (eg from DB) can be used as they are into your email sending routine.

You could separate your email sending code and the 'getting vars' code into two different files if you also need the ability to send manually via form...

require "sendmail.php"; // just functions for creating/sending

    ...grab cleaned $_POST vars and set them to regular variables 
    ...set variables here - same names as above (for CRON)

...run functions from sendmail.php

Off the top of my head. Notice no security here.