SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 32 of 32
  1. #26
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No. I am not sure exactly how you do that either. Would you care to fill me in on that process and how to do it? Is that a better way?

  2. #27
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How about take a checkbox in the main form, and say: check this if you want to the report would be emailed. And you can solve with only one form.

  3. #28
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I like your idea. So basically if the box is checked when the user clicks the "Get Report" button ("send_data1") the report would populate the screen and automatically be emailed without the need of clicking another button to send it.

  4. #29
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another idea I would like to implement is if the box to email the form is checked then the below it a list of possible email addresses would show up with check boxes beside each email address. I want to allow the user to select from a list of email addresses who to send the report to. So if a box is checked that email address would be added to the $to variable in the mail function and the email would be sent to only the email addresses selected.

  5. #30
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    multiple select box then would be a good idea. I often make contact lists with array or by database. Where you visible the names, and their email address stored in an array.

  6. #31
    SitePoint Enthusiast
    Join Date
    Dec 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had the email functionality of this report working great and then the client decided they wanted to change how the emailing of the report worked. This link shows how the page was working: http://www.mccawphotographics.com/qc...-div-forum.php The user could check the box that said "Check if you want to email this report." and then when they hit the "Get Report" button the report would show and would email to the selected emails at the same time.

    Now the client wants to have the user select the dates and hit "Get Report" When the report shows up they also want the "Email Report" button and the "Check if you want to email this report." checkbox to show up below the report.

    So I moved the checkbox and added a button to send the email (the button is named "send_report"). When testing this new page the email that is sent is blank and doesn't contain the report. I am not sure why moving the checkbox and adding another button is messing up the email. I have attached the working file. The working file is named: reports-final-div-forum-sample.php. The file with my changes is named: reports-final-div3-forum-sample.php.

    I moved the checkbox to below the output of the report and below shows it at the bottom of the code after the output of the report:
    PHP Code:
    ob_start();
                                    
    echo (
    "<h5>Start Date: " date('F j, Y',strtotime($time1)) . " || End Date: " date('F j, Y',strtotime($time2)) . "</h5>");
    echo (
    "<table width='650' cellpadding='2' cellspacing='1' border='1' class='table'>");
         echo (
    "<tr align='center'>");
              echo (
    "<td class='bold'><b>Wire Gauge</b></td>");
              echo (
    "<td colspan='3' class='bold'><b>Beam Pull</b></td>");
              echo (
    "<td colspan='3' class='bold'><b>Fracture Point</b></td>");
         echo (
    "</tr>");
         echo (
    "<tr align='center'>");
                echo (
    "<td>&nbsp;</td>");
                echo (
    "<td class='bold'><b>MIN</b></td>");
                echo (
    "<td class='bold'><b>MAX</b></td>");
                echo (
    "<td class='bold'><b>AVG</b></td>");
                echo (
    "<td class='bold'><b>Anchor Bend</b></td>");
                echo (
    "<td class='bold'><b>Break Back</b></td>");
                echo (
    "<td class='bold'><b>Weld</b></td>");
          echo (
    "</tr>");
          echo (
    "<tr align='center'>");
                echo (
    "<td class='bold'><b>2 Gauge Loop</b></td>");
                echo (
    "<td>" $beamPullmin['2.0'] . "</td>");
                echo (
    "<td>" $beamPullmax['2.0'] . "</td>");
                echo (
    "<td>" round($beamPullavg['2.0']) . "</td>");
                echo (
    "<td>" round(($fractures['Anchor Bend']['2.0']/$total_2ga) * 100) . "%" "</td>");
                echo (
    "<td>" round(($fractures['Break Back']['2.0']/$total_2ga) * 100) . "%" "</td>");
                echo (
    "<td>" round(($fractures['Weld']['2.0']/$total_2ga) * 100) . "%" "</td>");
           echo (
    "</tr>");
    echo (
    "</table>");
                                            
    $output=ob_get_contents();
    ob_end_clean();
                                        
    echo 
    $output;
                                                                                
    echo (
    "<form action=\"\" method=\"post\" name=\"Email-report\" id=\"Email-report\">");
        echo (
    "<div>");
            echo (
    "<div>");
                      
    $time1=isset($_POST["time1"]) ? htmlspecialchars($_POST["time1"]) : '';
              
    $time2=isset($_POST["time2"]) ? htmlspecialchars($_POST["time2"]) : '';
              echo (
    "<input type=\"hidden\" name=\"time1\" value=\"$time1\">");
              echo (
    "<input type=\"hidden\" name=\"time2\" value=\"$time2\">");
              
        echo (
    "</div>");
                                                
    // Mail Check Box //

            
    echo ("<div class=\"check\">");
                 echo (
    "<input type=\"checkbox\" name=\"mail_check\" id=\"mail_check\" value=\"email\""); 
              if(
    $mail_check=='1'){ echo "checked=\"true\"";}
        echo (
    "/>");
            echo (
    "Check if you want to email this report.");
            echo (
    "</div>");
                            
            echo (
    "<div class=\"clear\"></div>");
                            
            
    // Hidden Email Addresses //
            
    echo ("<div class=\"check\" id=\"addresses\">");
                                    
            
    $sql "SELECT * FROM email ORDER BY email_drop ASC";
            
    $result mysql_query($sql$conn) or trigger_error("SQL"E_USER_ERROR);

            while(
    $row mysql_fetch_assoc($result)) 
                { 
                    echo (
    "<input type=\"checkbox\" name=\"emails[]\" checked " " id=\"" $row['id'] . "\"" " value=\"" $row['email_drop'] . "\" />");
                echo (
    "&nbsp;");
                echo (
    $row['name']);
                echo (
    "<br />"); 
                 }
                                        
            echo (
    "</div>");
            echo (
    "<div class=\"clear\"></div>");
            echo (
    "<div class=\"controls2\">");
                    echo (
    "<input type=\"submit\" name=\"send_report\" id=\"send_report\" value=\"Send Report\">");
            echo (
    "</div>");
                            
    echo (
    "</div>");
    echo (
    "</form>"); 
    Here is how the email portion changed:
    PHP Code:
    if (isset($_POST['mail_check']) && isset($_POST['send_report'])){ 
    All of the above code is in the file named "reports-final-div3-forum-sample.php" as well.

    Any ideas on how to fix this would be great!
    Thanks.
    Attached Files Attached Files

  7. #32
    SitePoint Enthusiast
    Join Date
    Nov 2009
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

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