query($q); while($d = mysqli_fetch_array($r)){ $sig = ''; if ($d['name'] != ''){ $q3 = "SELECT date_time_signed FROM signatures where signed_name_as = '$d[name]' and petition_id = '$petition_id'"; $r3 = $petition->query($q3); $d3 = mysqli_fetch_array($r3); if ($d3['date_time_signed'] != ''){ $sig = "SIGNATURE $d3[date_time_signed]"; } } // no petition_id available... petition (name) invite (id) are $presig=''; $q4="SELECT * FROM presign where email_for_follow_up = '$d[email]' and php_page like '/sign.php%'"; $r4 = $petition->query($q4); $d4 = mysqli_fetch_array($r4); if ($d4['action_on']){ $presig = "PRESIG $d4[action_on]"; } if ($presig != '' || $sig != ''){ $list3 .= "
  • $d[email] $presig $d[name] $sig
  • "; }else{ $list3 .= "
  • $d[date_sent] $d[email] $d[name]
  • "; } } $q="SELECT * FROM follow_up where status <> 'NEW' and petition_id = '$petition_id' order by id DESC"; $r = $petition->query($q); while($d = mysqli_fetch_array($r)){ $sig = ''; if ($d['name'] != ''){ $q3 = "SELECT date_time_signed FROM signatures where signed_name_as = '$d[name]' and petition_id = '$petition_id'"; $r3 = $petition->query($q3); $d3 = mysqli_fetch_array($r3); if ($d3['date_time_signed'] != ''){ $sig = "SIGNATURE $d3[date_time_signed]"; } } // no petition_id available... petition (name) invite (id) are $presig=''; $q4="SELECT * FROM presign where email_for_follow_up = '$d[email]' and php_page like '/sign.php%'"; $r4 = $petition->query($q4); $d4 = mysqli_fetch_array($r4); if ($d4['action_on']){ $presig = "PRESIG $d4[action_on]"; } if ($presig != '' || $sig != ''){ $list1 .= "
  • $d[email] $presig $d[name] $sig
  • "; }else{ $list2 .= "
  • $d[date_sent] $d[email] $d[name]
  • "; } } ob_start(); echo "

    Outbox

    "; echo "
      "; echo $list3; echo "
    "; $buffer = ob_get_clean(); if ($list3 != ''){ echo $buffer; } echo "

    Signed

    "; echo "
      "; echo $list1; echo "
    "; echo "

    Sent

    "; echo "
      "; echo $list2; echo "
    "; include_once('footer.php');