Jump to content

matt.sisto

Members
  • Posts

    205
  • Joined

  • Last visited

    Never

About matt.sisto

  • Birthday 02/09/1984

Profile Information

  • Gender
    Male
  • Location
    UK, Bournemouth

matt.sisto's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Well when you put it like that no, but how can I break it up?
  2. I have been trying to figure it out but I can't, any help appreciated. $sql = "SELECT email_address FROM consultant WHERE con_id = '$con_id1'"; $result=mysql_query($sql); $to = mysql_result($result, 0, 0); $sql = "SELECT email_address FROM consultant WHERE con_id = '$con_id2'"; $result=mysql_query($sql); $to.= mysql_result($result, 0, 0); $sql = "SELECT email_address FROM consultant WHERE con_id = '$con_id2'"; $result=mysql_query($sql); $to.= mysql_result($result, 0, 0); $sender = 'admin@salmonsreach.org'; $headers = "SRC: Administrative Team"; $message = "We would like to notify you that a client has booked an appointment with you. Thanks and Regards, SRC Administrative Team."; $message.= "<br /> Event date: ".$event_start."\n"; $message.= "<br /> Event end date: ".$end_date."\n"; $message.= "<br /> Service: ".$service."\n"; $message.= "<br /> Start time: ".$start_time."\n"; $message.= "<br /> Address: ".$address_first_line."\n"; $message.= "<br /> Post Code: ".$post_code."\n"; mail($to, $sender, $message, $headers); Thanks and regs.
  3. $sql = "SELECT first_name FROM client WHERE client_id= '$client_id'"; $result = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); if($result !=null){ $firstName =mysql_result($result,0,"first_name"); } $sql = "SELECT last_name FROM client WHERE client_id= '$client_id'"; $result = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); if($result !=null){ $lastName =mysql_result($result,0,"last_name"); } if ($con_id1 != null){ $result = mysql_query("SELECT email_address FROM consultant WHERE con_id= '$con_id1'"); if($result !=null){ $to =mysql_result($result,0,"email_address"); } } if ($con_id2 != null){ $result = mysql_query("SELECT email_address FROM consultant WHERE con_id= '$con_id2'"); if($result !=null){ $to.=mysql_result($result,0,"email_address"); } } if ($con_id3 != null){ $result = mysql_query("SELECT email_address FROM consultant WHERE con_id= '$con_id3'"); if($result !=null){ $to.=mysql_result($result,0,"email_address"); } } $result = mysql_query ($sql); $lastname=mysql_result($result,0,"lastName"); $sender = 'admin@salmonsreach.org'; $headers = "SRC: Administrative Team"; $message = "We would like to notify you that a client has booked an appointment with you. Thanks and Regards, SRC Administrative Team."; $message.= "<br /> Event date: ".$event_start."\n"; $message.= "<br /> Event end date: ".$end_date."\n"; $message.= "<br /> Service: ".$service."\n"; $message.= "<br /> Start time: ".$start_time."\n"; $message.= "<br /> Address: ".$address_first_line."\n"; $message.= "<br /> Post Code: ".$post_code."\n"; $message.= "<br /> Client: ".$firstName." ".$lastName."\n"; if(mail($to, $sender, $message, $headers)){ header("Location: confirmation.php"); exit(); } I have tried this but still no joy. Any ideas.
  4. What am I doing wrong? $sender = 'admin@salmonsreach.org'; $headers = "SRC: Administrative Team"; $message = "We would like to notify you that a client has booked an appointment with you. Thanks and Regards, SRC Administrative Team. <br /> Event date: $event_start <br /> Event end date: $end_date <br /> Service: $service <br /> Start time: $start_time <br /> Address: $address_first_line <br /> Post Code: $post_code <br /> Client: $firstName $lastName"; if(mail($to, $sender, $message, $headers)){ header("Location: confirmation.php"); exit(); }
  5. OK so I have now modified it taking your advice on board but still having major issues, if anyone can help, it would be greatly appreciated, I'm not sure if the mail script it self is right, if I have used the variables correctly ??? $sql = "SELECT first_name FROM client WHERE client_id= '$client_id'"; $result = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); if($result !=null){ $firstName =mysql_result($result,0,"first_name"); } $sql = "SELECT last_name FROM client WHERE client_id= '$client_id'"; $result = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); if($result !=null){ $lastName =mysql_result($result,0,"last_name"); } if ($con_id1 != null){ $result = mysql_query("SELECT email_address FROM consultant WHERE con_id= '$con_id1'"); if($result !=null){ $to =mysql_result($result,0,"email_address"); } } if ($con_id2 != null){ $result = mysql_query("SELECT email_address FROM consultant WHERE con_id= '$con_id2'"); if($result !=null){ $to.=mysql_result($result,0,"email_address"); } } if ($con_id3 != null){ $result = mysql_query("SELECT email_address FROM consultant WHERE con_id= '$con_id3'"); if($result !=null){ $to.=mysql_result($result,0,"email_address"); } } $result = mysql_query ($sql); $lastname=mysql_result($result,0,"lastName"); $sender = 'admin@salmonsreach.org'; $headers = "SRC: Administrative Team"; $message = "We would like to notify you that a client has booked an appointment with you. Thanks and Regards, SRC Administrative Team. <br /> Event date: $event_start <br /> Event end date: $end_date <br /> Service: $service <br /> Start time: $start_time <br /> Address: $address_first_line <br /> Post Code: $post_code <br /> Client: $firstName $lastName"; if(mail($to, $sender, $message, $headers)){ header("Location: confirmation.php"); exit(); } Thanks and regs.
  6. <?php $sql = "INSERT INTO calendar_events VALUES (0,'".$event_start."','".$end_date."','".$client_id."','".$service."','".$unit."','".$quantity."','".$start_time."','".$end_Time."','".$con_id1."','".$con_id2."','".$con_id3."','".$eventTotal."','".$address_first_line."','".$post_code."','".$country."','".$extra_info."')"; $result = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT first_name FROM client WHERE client_id= '$client_id'"; $firstName = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); $sql = "SELECT last_name FROM client WHERE client_id= '$client_id'"; $lastName = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); $clientName = $firstName." ".$lastName; if ($con_id1 != null){ $sql = "SELECT email_address FROM consultant WHERE con_id= '$con_id1'"; $to = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); } if ($con_id2 != null){ $sql = "SELECT email_address FROM consultant WHERE con_id= '$con_id2'"; $to.= mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); } if ($con_id3 != null){ $sql = "SELECT email_address FROM consultant WHERE con_id= '$con_id3'"; $to.= mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); } $sender = 'admin@salmonsreach.org'; $headers = "SRC: Administrative Team"; $message = "We would like to notify you that a client has booked an appointment with you. Thanks and Regards, SRC Administrative Team. <br /> Event date: $event_start <br /> Event end date: $end_date <br /> Service: $service <br /> Start time: $start_time <br /> Address: $address_first_line <br /> Post Code: $post_code <br /> Client: $clientName"; if(mail($to, $sender, $message, $headers)){ header("Location: confirmation.php"); exit(); } ?> I noticed a mistake and I have now changed it, but still not working. Any ideas ???
  7. Hello, I am trying to get my script to notify the consultant sif a booking is successful, burt it just defaults to the index page when it reaches my mail script: <?php $sql = "INSERT INTO calendar_events VALUES (0,'".$event_start."','".$end_date."','".$client_id."','".$service."','".$unit."','".$quantity."','".$start_time."','".$end_Time."','".$con_id1."','".$con_id2."','".$con_id3."','".$eventTotal."','".$address_first_line."','".$post_code."','".$country."','".$extra_info."')"; $result = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT first_name FROM client WHERE client_id= '$client_id'"; $firstName = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); $sql = "SELECT last_name FROM client WHERE client_id= '$client_id'"; $lastName = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); $clientName = $firstName." ".$lastName; if ($con_id1 != null){ $sql = "SELECT email_address FROM consultant WHERE con_id= '$con_id1'"; $to = mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); } if ($con_id2 != null){ $sql = "SELECT email_address FROM consultant WHERE con_id= '$con_id2'"; $to.= mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); } if ($con_id3 != null){ $sql = "SELECT email_address FROM consultant WHERE con_id= '$con_id3'"; $to.= mysql_query ($sql, $connection) or die ("Could not perform query $sql <br />".mysql_error()); } $sender = 'admin@salmonsreach.org'; $headers = "SRC: Administrative Team"; $message = "We would like to notify you that a client has booked an appointment with you. Thanks and Regards, SRC Administrative Team. <br /> Event date: $event_start <br /> Event end date: $ $end_date <br /> Service: $service <br /> Start time: $start_time <br /> Address: $address_first_line <br /> Post Code: $post_code <br /> Client: $clientName"; if(mail($to, $sender, $message, $headers)){ header("Location: confirmation.php"); exit(); } ?> Any help appreciated. Thanks and regs.
  8. Thanks again. <?php session_start(); if (!isset($_SESSION['username'])) { header("Location: login.php"); exit(); } require "dbconn2.php"; $org_id = $_POST["org_id"]; $month1 = $_POST["month1"]; $day1 = $_POST["day1"]; $year1 = $_POST["year1"]; $month2 = $_POST["month2"]; $day2 = $_POST["day2"]; $year2 = $_POST["year2"]; if( $org_id == 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $month1 == 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $day1 == 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $year1 == 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $month2 == 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $day2 == 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $year2 == 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } $invoice_start = $year1."-".$month1."-".$day1." ".$_POST["event_start"]; $invoice_end = $year2."-".$month2."-".$day2." ".$_POST["event_end"]; $sql = "SELECT SUM(fee) FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result !=null){ $totalFee = mysql_result($result, 0); } $vat = (int)$totalFee/100*15; $invoiceFee = (int)$vat + (int)$totalFee; $sql = "SELECT title, address_first_line, post_code, first_name, last_name, email_address FROM organisation where org_id = '".$org_id."'"; $result1 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT client_id, first_name, last_name, email_address FROM client where org_id = '".$org_id."'"; $result2 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT event_id, event_start, event_end, service_id, unit, quantity, fee FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result3 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT title FROM organisation where org_id = '".$org_id."'"; $result4 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result4 !=null){ $title = mysql_result($result4, 0); } $sql = "SELECT email_address FROM organisation where org_id = '".$org_id."'"; $result5 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result5 !=null){ $to = mysql_result($result5, 0); } $headers .="Content-type: text/html; charset=utf-8\r\n"; $headers .="From: Admin <admin@salmonsreach.org>"; $subject ="SRC: Invoice"; ob_start(); ?> <html> <head> <title>Invoice</title> </head> <body> <h1>Organisation: <?php echo "$title"?> Invoice Start: <?php echo "$invoice_start"?> Invoice End: <?php echo "$invoice_end"?></h1> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th align="center">Logo </th> <th align="center">Address</th> <th align="center">SRC: Striving to achieve excellence</th> <th align="center">Email Address</th> </tr> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Title </th> <th bgcolor="#CCCCCC" align="center">Address</th> <th bgcolor="#CCCCCC" align="center">Post Code</th> <th bgcolor="#CCCCCC" align="center">Admin First Name</th> <th bgcolor="#CCCCCC" align="center">Admin Last Name</th> <th bgcolor="#CCCCCC" align="center">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result1)) {?> <tr> <td align="center"><?=$row['title']?></td> <td align="center"><?=$row['address_first_line']?></td> <td align="center"><?=$row['post_code']?></td> <td align="center"><?=$row['first_name']?></td> <td align="center"><?=$row['last_name']?></td> <td align="center"><?=$row['email_address']?></td> </tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center"> Client ID </th> <th bgcolor="#CCCCCC" align="center">First Name</th> <th bgcolor="#CCCCCC" align="center">Last Name</th> <th bgcolor="#CCCCCC" align="center">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result2)) {?> <tr> <td align="center"><?=$row['client_id']?></td> <td align="center"><?=$row['first_name']?></td> <td align="center"><?=$row['last_name']?></td> <td align="center"><?=$row['email_address']?></td ></tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Event ID</th> <th bgcolor="#CCCCCC" align="center">Client ID</th> <th bgcolor="#CCCCCC" align="center">Service ID</th> <th bgcolor="#CCCCCC" align="center">Unit</th> <th bgcolor="#CCCCCC" align="center">Quantity</th> <th bgcolor="#CCCCCC" align="center">Start Date</th> <th bgcolor="#CCCCCC" align="center">End Date</th> <th bgcolor="#CCCCCC" align="center">Fee [£]</th> </tr> <?php while ($row = mysql_fetch_array($result3)) {?> <tr> <td align="center"><?=$row['event_id']?></td> <td align="center"><?=$row['client_id']?></td> <td align="center"><?=$row['service_id']?></td> <td align="center"><?=$row['unit']?></td> <td align="center"><?=$row['quantity']?></td> <td align="center"><?=$row['event_start']?></td> <td align="center"><?=$row['event_end']?></td> <td align="center"><?=$row['fee']?></td> </tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Sub Total [£]</th> <th bgcolor="#CCCCCC" align="center">VAT [£]</th> <th bgcolor="#CCCCCC" align="center">Total [£]</th> </tr> <tr> <td align="center"><?php echo "$totalFee"?></td> <td align="center"><?php echo "$vat"?></td> <td align="center"><?php echo "$invoiceFee"?></td> </tr> </table> </body> </html> <?php $body = ob_get_contents(); ob_end_clean(); if(!mail($to, $subject, $body, $headers)){ die("Error sending message"); } $url = "Location: createInvoice.php?success=true";//mail sent header($url); exit(); ?>
  9. I know my code is a mess, but I am still learning. At the moment its trial and error and I have only been learning since christmas so I know I've got alot to learn, but appreciate all the help. I have the hscript working without the mail function. <?php session_start(); if (!isset($_SESSION['username'])) { header("Location: login.php"); exit(); } require "dbconn2.php"; $org_id = $_POST["org_id"]; $month1 = $_POST["month1"]; $day1 = $_POST["day1"]; $year1 = $_POST["year1"]; $month2 = $_POST["month2"]; $day2 = $_POST["day2"]; $year2 = $_POST["year2"]; if( $org_id = 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $month1 = 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $day1 = 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $year1 = 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $month2 = 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $day2 = 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } if( $year2 = 'nil'){ $url = "Location: createInvoice.php?error1=true";//ERROR 1 header($url); exit(); } $invoice_start = $year1."-".$month1."-".$day1." ".$_POST["event_start"]; $invoice_end = $year2."-".$month2."-".$day2." ".$_POST["event_end"]; $sql = "SELECT SUM(fee) FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result !=null){ $totalFee = mysql_result($result, 0); } $vat = (int)$totalFee/100*15; $invoiceFee = (int)$vat + (int)$totalFee; $sql = "SELECT title, address_first_line, post_code, first_name, last_name, email_address FROM organisation where org_id = '".$org_id."'"; $result1 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT client_id, first_name, last_name, email_address FROM client where org_id = '".$org_id."'"; $result2 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT event_id, event_start, event_end, service_id, unit, quantity, fee FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result3 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT title FROM organisation where org_id = '".$org_id."'"; $result4 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result4 !=null){ $title = mysql_result($result4, 0); } ?> <html> <head> <title>Invoice</title> </head> <body> <h1>Organisation: <?php echo "$title"?> Invoice Start: <?php echo "$invoice_start"?> Invoice End: <?php echo "$invoice_end"?></h1> <div id="mid"> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th align="center">Logo </th> <th align="center">Address</th> <th align="center">SRC: Striving to achieve excellence</th> <th align="center">Email Address</th> </tr> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Title </th> <th bgcolor="#CCCCCC" align="center">Address</th> <th bgcolor="#CCCCCC" align="center">Post Code</th> <th bgcolor="#CCCCCC" align="center">Admin First Name</th> <th bgcolor="#CCCCCC" align="center">Admin Last Name</th> <th bgcolor="#CCCCCC" align="center">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result1)) {?> <tr> <td align="center"><?=$row['title']?></td> <td align="center"><?=$row['address_first_line']?></td> <td align="center"><?=$row['post_code']?></td> <td align="center"><?=$row['first_name']?></td> <td align="center"><?=$row['last_name']?></td> <td align="center"><?=$row['email_address']?></td> </tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center"> Client ID </th> <th bgcolor="#CCCCCC" align="center">First Name</th> <th bgcolor="#CCCCCC" align="center">Last Name</th> <th bgcolor="#CCCCCC" align="center">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result2)) {?> <tr> <td align="center"><?=$row['client_id']?></td> <td align="center"><?=$row['first_name']?></td> <td align="center"><?=$row['last_name']?></td> <td align="center"><?=$row['email_address']?></td ></tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Event ID</th> <th bgcolor="#CCCCCC" align="center">Client ID</th> <th bgcolor="#CCCCCC" align="center">Service ID</th> <th bgcolor="#CCCCCC" align="center">Unit</th> <th bgcolor="#CCCCCC" align="center">Quantity</th> <th bgcolor="#CCCCCC" align="center">Start Date</th> <th bgcolor="#CCCCCC" align="center">End Date</th> <th bgcolor="#CCCCCC" align="center">Fee [£]</th> <th bgcolor="#CCCCCC" align="center">Remove</th> </tr> <?php while ($row = mysql_fetch_array($result3)) {?> <tr> <td align="center"><?=$row['event_id']?></td> <td align="center"><?=$row['client_id']?></td> <td align="center"><?=$row['service_id']?></td> <td align="center"><?=$row['unit']?></td> <td align="center"><?=$row['quantity']?></td> <td align="center"><?=$row['event_start']?></td> <td align="center"><?=$row['event_end']?></td> <td align="center"><?=$row['fee']?></td> <td align="center"><a href="deleteevent.php?event_id=<?=$row['event_id']?>">[-]</a></td> </tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Sub Total [£]</th> <th bgcolor="#CCCCCC" align="center">VAT [£]</th> <th bgcolor="#CCCCCC" align="center">Total [£]</th> </tr> <tr> <td align="center"><?php echo "$totalFee"?></td> <td align="center"><?php echo "$vat"?></td> <td align="center"><?php echo "$invoiceFee"?></td> </tr> </table> </div> </body> </html> But it just outputs the queries in a HTML page, and I would like to be able to send it, hence me trying to squeeze it all into the mail function, but clearly I failed. :'(
  10. <?php while ($row = mysql_fetch_array($result3)) {?> I was thinking it might have problems with these bits?
  11. <?php session_start(); if (!isset($_SESSION['username'])) { header("Location: login.php"); exit(); } require "dbconn2.php"; $org_id = $_POST["org_id"]; $month1 = $_POST["month1"]; $day1 = $_POST["day1"]; $year1 = $_POST["year1"]; $month2 = $_POST["month2"]; $day2 = $_POST["day2"]; $year2 = $_POST["year2"]; $invoice_start = $year1."-".$month1."-".$day1." ".$_POST["event_start"]; $invoice_end = $year2."-".$month2."-".$day2." ".$_POST["event_end"]; $sql = "SELECT SUM(fee) FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result !=null){ $totalFee = mysql_result($result, 0); } $vat = (int)$totalFee/100*15; $invoiceFee = (int)$vat + (int)$totalFee; $sql = "SELECT email_address FROM organisation where org_id = '".$org_id."'"; $result1 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result1 !=null){ $to = mysql_result($result1, 0); } $sql = "SELECT title, address_first_line, post_code, first_name, last_name, email_address FROM organisation where org_id = '".$org_id."'"; $result1 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT client_id, first_name, last_name, email_address FROM client where org_id = '".$org_id."'"; $result2 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT event_id, event_start, event_end, service_id, unit, quantity, fee FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result3 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $headers ="MIME-Version: 1.0\r\n"; $headers .="Content-type: text/html; charset=utf-8\r\n"; $headers .="From: Admin <admin@salmonsreach.org>"; $subject ="SRC: Invoice"; $body =" <html> <head> <title>Invoice</title> </head> <body> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th align=\"center\">Logo </th> <th align=\"center\">Address</th> <th align=\"center\">SRC: Striving to achieve excellence</th> <th align=\"center\">Email Address</th> </tr> </table> <h1>Organisation: <?php echo \"$title\"?> Invoice Start: <?php echo \"$invoice_start\"?> Invoice End: <?php echo \"$invoice_end\"?></h1> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th align=\"center\">Logo </th> <th align=\"center\">Address</th> <th align=\"center\">SRC: Striving to achieve excellence</th> <th align=\"center\">Email Address</th> </tr> </table> <br /> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th bgcolor=\"#CCCCCC\" align=\"center\">Title </th> <th bgcolor=\"#CCCCCC\" align=\"center\">Address</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Post Code</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Admin First Name</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Admin Last Name</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result1)) {?> <tr> <td align=\"center\"><?=$row['title']?></td> <td align=\"center\"><?=$row['address_first_line']?></td> <td align=\"center\"><?=$row['post_code']?></td> <td align=\"center\"><?=$row['first_name']?></td> <td align=\"center\"><?=$row['last_name']?></td> <td align=\"center\"><?=$row['email_address']?></td> </tr> <?php } ?> </table> <br /> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th bgcolor=\"#CCCCCC\" align=\"center\"> Client ID </th> <th bgcolor=\"#CCCCCC\" align=\"center\">First Name</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Last Name</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result2)) {?> <tr> <td align=\"center\"><?=$row['client_id']?></td> <td align=\"center\"><?=$row['first_name']?></td> <td align=\"center\"><?=$row['last_name']?></td> <td align=\"center\"><?=$row['email_address']?></td ></tr> <?php } ?> </table> <br /> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th bgcolor=\"#CCCCCC\" align=\"center\">Event ID</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Client ID</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Service ID</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Unit</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Quantity</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Start Date</th> <th bgcolor=\"#CCCCCC\" align=\"center\">End Date</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Fee [£]</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Remove</th> </tr> <?php while ($row = mysql_fetch_array($result3)) {?> <tr> <td align=\"center\"><?=$row['event_id']?></td> <td align=\"center\"><?=$row['client_id']?></td> <td align=\"center\"><?=$row['service_id']?></td> <td align=\"center\"><?=$row['unit']?></td> <td align=\"center\"><?=$row['quantity']?></td> <td align=\"center\"><?=$row['event_start']?></td> <td align=\"center\"><?=$row['event_end']?></td> <td align=\"center\"><?=$row['fee']?></td> <td align=\"center\"><a href=\"deleteevent.php?event_id=<?=$row['event_id']?>\">[-]</a></td> </tr> <?php } ?> </table> <br /> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th bgcolor=\"#CCCCCC\" align=\"center\">Sub Total [£]</th> <th bgcolor=\"#CCCCCC\" align=\"center\">VAT [£]</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Total [£]</th> </tr> <tr> <td align=\"center\"><?php echo \"$totalFee\"?></td> <td align=\"center\"><?php echo \"$vat\"?></td> <td align=\"center\"><?php echo \"$invoiceFee\"?></td> </tr> </table> </legend> </body> </html> "; if(!mail($to, $subject, $body, $headers)){ die("Error sending message"); } ?> Tried this but it just displays a blank screen, do you think it has an issue with the php within the html?
  12. Tried what you suggested but it doesn't seem to be working, don't know what I'm doing wrong. ??? <?php session_start(); if (!isset($_SESSION['username'])) { header("Location: login.php"); exit(); } require "dbconn2.php"; $org_id = $_POST["org_id"]; $month1 = $_POST["month1"]; $day1 = $_POST["day1"]; $year1 = $_POST["year1"]; $month2 = $_POST["month2"]; $day2 = $_POST["day2"]; $year2 = $_POST["year2"]; $invoice_start = $year1."-".$month1."-".$day1." ".$_POST["event_start"]; $invoice_end = $year2."-".$month2."-".$day2." ".$_POST["event_end"]; $sql = "SELECT SUM(fee) FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result !=null){ $totalFee = mysql_result($result, 0); } $vat = (int)$totalFee/100*15; $invoiceFee = (int)$vat + (int)$totalFee; $sql = "SELECT email_address FROM organisation where org_id = '".$org_id."'"; $result1 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result !=null){ $to = mysql_result($result, 0); } $sql = "SELECT title, address_first_line, post_code, first_name, last_name, email_address FROM organisation where org_id = '".$org_id."'"; $result1 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT client_id, first_name, last_name, email_address FROM client where org_id = '".$org_id."'"; $result2 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT event_id, event_start, event_end, service_id, unit, quantity, fee FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result3 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=utf-8\n"; $headers = "From: Admin <admin@salmonsreach.org>"; $subject ="SRC: Invoice"; $body = " <html> <head> <title>Invoice</title> </head> <body> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th align=\"center\">Logo </th> <th align=\"center\">Address</th> <th align=\"center\">SRC: Striving to achieve excellence</th> <th align=\"center\">Email Address</th> </tr> </table> <h1>Organisation:<?php echo\"$title\"?>Invoice Start:<?php echo\"$invoice_start\"?> Invoice End:<?php echo\"$invoice_end\"?></h1>//For some reason a couple of the slashes are not being displayed? <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th align=\"center\">Logo </th> <th align=\"center\">Address</th> <th align=\"center\">SRC: Striving to achieve excellence</th> <th align=\"center\">Email Address</th> </tr> </table> <br /> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th bgcolor=\"#CCCCCC\" align=\"center\">Title </th> <th bgcolor=\"#CCCCCC\" align=\"center\">Address</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Post Code</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Admin First Name</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Admin Last Name</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result1)) {?> <tr> <td align=\"center\"><?=$row['title']?></td> <td align=\"center\"><?=$row['address_first_line']?></td> <td align=\"center\"><?=$row['post_code']?></td> <td align=\"center\"><?=$row['first_name']?></td> <td align=\"center\"><?=$row['last_name']?></td> <td align=\"center\"><?=$row['email_address']?></td> </tr> <?php } ?> </table> <br /> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th bgcolor=\"#CCCCCC\" align=\"center\"> Client ID </th> <th bgcolor=\"#CCCCCC\" align=\"center\">First Name</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Last Name</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result2)) {?> <tr> <td align=\"center\"><?=$row['client_id']?></td> <td align=\"center\"><?=$row['first_name']?></td> <td align=\"center\"><?=$row['last_name']?></td> <td align=\"center\"><?=$row['email_address']?></td ></tr> <?php } ?> </table> <br /> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th bgcolor=\"#CCCCCC\" align=\"center\">Event ID</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Client ID</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Service ID</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Unit</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Quantity</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Start Date</th> <th bgcolor=\"#CCCCCC\" align=\"center\">End Date</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Fee [£]</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Remove</th> </tr> <?php while ($row = mysql_fetch_array($result3)) {?> <tr> <td align=\"center\"><?=$row['event_id']?></td> <td align=\"center\"><?=$row['client_id']?></td> <td align=\"center\"><?=$row['service_id']?></td> <td align=\"center\"><?=$row['unit']?></td> <td align=\"center\"><?=$row['quantity']?></td> <td align=\"center\"><?=$row['event_start']?></td> <td align=\"center\"><?=$row['event_end']?></td> <td align=\"center\"><?=$row['fee']?></td> <td align=\"center\"><a href=\"deleteevent.php?event_id=<?=$row['event_id']?>\">[-]</a></td> </tr> <?php } ?> </table> <br /> <table id=\"table\" cellpadding=\"1px\" cellspacing=\"1px\" bordercolordark=\"#333\"> <tr> <th bgcolor=\"#CCCCCC\" align=\"center\">Sub Total [£]</th> <th bgcolor=\"#CCCCCC\" align=\"center\">VAT [£]</th> <th bgcolor=\"#CCCCCC\" align=\"center\">Total [£]</th> </tr> <tr> <td align=\"center\"><?php echo \"$totalFee\"?></td> <td align=\"center\"><?php echo \"$vat\"?></td> <td align=\"center\"><?php echo \"$invoiceFee\"?></td> </tr> </table> </legend> </body> </html> "; if(!mail($to, $subject, $body, $headers)){ die("Error sending message"); } ?>
  13. I was thinking something like this: <?php session_start(); if (!isset($_SESSION['username'])) { header("Location: login.php"); exit(); } require "dbconn2.php"; $org_id = $_POST["org_id"]; $month1 = $_POST["month1"]; $day1 = $_POST["day1"]; $year1 = $_POST["year1"]; $month2 = $_POST["month2"]; $day2 = $_POST["day2"]; $year2 = $_POST["year2"]; $invoice_start = $year1."-".$month1."-".$day1." ".$_POST["event_start"]; $invoice_end = $year2."-".$month2."-".$day2." ".$_POST["event_end"]; $sql = "SELECT SUM(fee) FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result !=null){ $totalFee = mysql_result($result, 0); } $vat = (int)$totalFee/100*15; $invoiceFee = (int)$vat + (int)$totalFee; $sql = "SELECT email_address FROM organisation where org_id = '".$org_id."'"; $result1 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); if($result !=null){ $to = mysql_result($result, 0); } $sql = "SELECT title, address_first_line, post_code, first_name, last_name, email_address FROM organisation where org_id = '".$org_id."'"; $result1 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT client_id, first_name, last_name, email_address FROM client where org_id = '".$org_id."'"; $result2 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $sql = "SELECT event_id, event_start, event_end, service_id, unit, quantity, fee FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; $result3 = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); $subject ='Invoice'; $headers = 'From: info <admin@salmonsreach.org>'; $message = ' <html> <head> <title>Invoice</title> </head> <body> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th align="center">Logo </th> <th align="center">Address</th> <th align="center">SRC: Striving to achieve excellence</th> <th align="center">Email Address</th> </tr> </table> <legend>Invoice Start: <?php echo "$invoice_start"?> Invoice End: <?php echo "$invoice_end"?> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Title </th> <th bgcolor="#CCCCCC" align="center">Address</th> <th bgcolor="#CCCCCC" align="center">Post Code</th> <th bgcolor="#CCCCCC" align="center">Admin First Name</th> <th bgcolor="#CCCCCC" align="center">Admin Last Name</th> <th bgcolor="#CCCCCC" align="center">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result1)) {?> <tr> <td align="center"><?=$row['title']?></td> <td align="center"><?=$row['address_first_line']?></td> <td align="center"><?=$row['post_code']?></td> <td align="center"><?=$row['first_name']?></td> <td align="center"><?=$row['last_name']?></td> <td align="center"><?=$row['email_address']?></td> </tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center"> Client ID </th> <th bgcolor="#CCCCCC" align="center">First Name</th> <th bgcolor="#CCCCCC" align="center">Last Name</th> <th bgcolor="#CCCCCC" align="center">Email Address</th> </tr> <?php while ($row = mysql_fetch_array($result2)) {?> <tr> <td align="center"><?=$row['client_id']?></td> <td align="center"><?=$row['first_name']?></td> <td align="center"><?=$row['last_name']?></td> <td align="center"><?=$row['email_address']?></td ></tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Event ID</th> <th bgcolor="#CCCCCC" align="center">Client ID</th> <th bgcolor="#CCCCCC" align="center">Service ID</th> <th bgcolor="#CCCCCC" align="center">Unit</th> <th bgcolor="#CCCCCC" align="center">Quantity</th> <th bgcolor="#CCCCCC" align="center">Start Date</th> <th bgcolor="#CCCCCC" align="center">End Date</th> <th bgcolor="#CCCCCC" align="center">Fee [£]</th> <th bgcolor="#CCCCCC" align="center">Remove</th> </tr> <?php while ($row = mysql_fetch_array($result3)) {?> <tr> <td align="center"><?=$row['event_id']?></td> <td align="center"><?=$row['client_id']?></td> <td align="center"><?=$row['service_id']?></td> <td align="center"><?=$row['unit']?></td> <td align="center"><?=$row['quantity']?></td> <td align="center"><?=$row['event_start']?></td> <td align="center"><?=$row['event_end']?></td> <td align="center"><?=$row['fee']?></td> <td align="center"><a href="deleteevent.php?event_id=<?=$row['event_id']?>">[-]</a></td> </tr> <?php } ?> </table> <br /> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="center">Sub Total [£]</th> <th bgcolor="#CCCCCC" align="center">VAT [£]</th> <th bgcolor="#CCCCCC" align="center">Total [£]</th> </tr> <tr> <td align="center"><?php echo "$totalFee"?></td> <td align="center"><?php echo "$vat"?></td> <td align="center"><?php echo "$invoiceFee"?></td> </tr> </table> </legend> </body> </html> '; mail($to, $subject, $message, $headers); ?> Question is will it work? ???
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.