techker Posted September 20, 2012 Share Posted September 20, 2012 Hey guys i have a portal that im doing for invoicing.. i have a page that shows all the unpaid invoices.. i put a check box next in the form...how can i select multiple selection and print the total amount of the selected with the invoice numbers.?? like check box. invoice 2122 total 200$ check box. invoice 2123 total 200$ check box. invoice 2124 total 200$ check box. invoice 2125 total 200$ check box. invoice 2126 total 200$ so the print out would be invoices: 2122-2123-2124-2125-2126 total before tax:1000$ Quote Link to comment Share on other sites More sharing options...
fenway Posted September 21, 2012 Share Posted September 21, 2012 Not sure what you're asking -- client-side or server-side -- but in any event, it's not directly mysql related (since you obviously queried the table successfully to show the info in the first place). Quote Link to comment Share on other sites More sharing options...
techker Posted September 21, 2012 Author Share Posted September 21, 2012 well ya?it needs to take the id's select search the database and calculate the total amount..?no Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 21, 2012 Share Posted September 21, 2012 Do the math in PHP, or use SUM Quote Link to comment Share on other sites More sharing options...
Barand Posted September 22, 2012 Share Posted September 22, 2012 First, the checkbox values should be the respective invoice numbers <input type='checkbox' name='selectedInvoice[]' value='$invnumber'> To process $list = join(',', array_map('intval', $_POST['selectedInvoice'])); the query SELECT GROUP_CONCAT(invoicenumber SEPARATOR '-') AS invoices, SUM(invoicetotal) AS total FROM invoices WHERE invoicenumber IN ($list) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.