Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    86
    Thanks
    3
    Thanked 2 Times in 2 Posts

    help with script to email values up to 240 fields

    I'm trying to avoid the brackets if at all possible since certain codes are dependent on no brackets.

    I found a solution but I'm back to the beginning with an old question again.

    I need all the empty rows to not show when emailed or printed and to only show non empty values in there respected columns only.

    PHP Code:
    foreach($_POST as $key => $val){
      if(
    preg_match("/textbox_r\d+\_c1/"$key)){
        
    $msg .= "<tr><td>$val</td>";
      };
      if(
    preg_match("/textbox_r\d+\_c2/"$key)){
        
    $msg .= "<td>$val</td>";
      };
      if(
    preg_match("/textbox_r\d+\_c3/"$key)){
        
    $msg .= "<td>$val</td>";
      };
      if(
    preg_match("/textbox_r\d+\_c4/"$key)){
        
    $msg .= "<td>$val</td>";
      };
      if(
    preg_match("/textbox_r\d+\_c5/"$key)){
        
    $msg .= "<td>$val</td>";
      };
      if(
    preg_match("/textbox_r\d+\_c6/"$key)){
        
    $msg .= "<td>$val</td>";
      };
      if(
    preg_match("/textbox_r\d+\_c7/"$key)){
        
    $msg .= "<td>$val</td>";
      };
      if(
    preg_match("/textbox_r\d+\_c8/"$key)){
        
    $msg .= "<td>$val</td>";
      };
      if(
    preg_match("/textbox_r\d+\_c9/"$key)){
        
    $msg .= "<td>$val</td></tr>";
      };
    }; 
    Last edited by Jodarecode; 03-17-2009 at 07:08 PM.
    "The one closer to the truth is the one still learning"

  • #2
    New Coder
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    86
    Thanks
    3
    Thanked 2 Times in 2 Posts
    OK, fixed that

    Now it pushes the values one TD to the right leaving a blank TD in the beginning and extending the 9th TD into the 10th column, Why would this be happening? any ideas?

    PHP Code:
    for($a 0$a <= 240$a++) {
      
    $emptyrow true;
      
    $temp[] = '<tr>';
      for(
    $b 0$b <= 9$b++) {
           
    $temp[] = '<td align="right">' $_POST['textbox_r'.$a.'_c'.$b] . '</td>';
           if(
    $_POST['textbox_r'.$a.'_c'.$b] != '')
              
    $emptyrow false;
      }
      
    $temp[] = '</tr>';
      if(
    $emptyrow == false)
        
    $out[] = implode($temp'');
      unset(
    $temp);
    }
    $msg .= implode($out''); 
    Last edited by Jodarecode; 03-17-2009 at 05:51 PM.
    "The one closer to the truth is the one still learning"

  • #3
    New Coder
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    86
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Resolved!

    needed to change
    PHP Code:
     for($b 0$b <= 9$b++) 
    to
    PHP Code:
     for($b 1$b <= 9$b++) 
    PHP Code:
    for($a 0$a <= 240$a++) {
      
    $emptyrow true;
      
    $temp[] = '<tr>';
      for(
    $b 1$b <= 9$b++) {
           
    $temp[] = '<td align="right">' $_POST['textbox_r'.$a.'_c'.$b] . '</td>';
           if(
    $_POST['textbox_r'.$a.'_c'.$b] != '')
              
    $emptyrow false;
      }
      
    $temp[] = '</tr>';
      if(
    $emptyrow == false)
        
    $out[] = implode($temp'');
      unset(
    $temp);
    }
    $msg .= implode($out''); 
    "The one closer to the truth is the one still learning"


  •  

    Posting Permissions

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