Jump to content

newbiephp2020

New Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by newbiephp2020

  1. Hi Guys, How do i put a comma separator after a thousand ? Example if $grand28 was equal to 1234.00 how do i get it to read 1,234.00 here is my code " . sprintf("%.2f", $grand28) . "
  2. works ok but url repeating in browser window
  3. here is the full page code <?php session_start(); include('../inc/config.php'); include(ROOT_PATH . 'inc/functions.php'); if (!isset($_SESSION['login'])) { header("Location: " . BASE_URL . "account/login.php"); exit; } if (isset($_SESSION['membership_expired'])) { header("Location: " . BASE_URL . "account/upgradeaccount.php?expired=true"); exit; } $mileage_data = yegetMileageByUserId($_SESSION['login']['id']); include(ROOT_PATH . 'inc/header.php'); ?> <div id="wrapper"> <?php include(ROOT_PATH . 'inc/partials/account-nav.php'); ?> <div id="account-info"> <h3>View Mileage.</h3> <form method="post" action="testmileage.php" name="mileage" id = "mileage"> <input type="hidden" name="start-date" value="2020-04-06"> <input type="hidden" name="end-date" value="2021-04-05"> </form> <script>window.onload = function(){ document.mileage.submit(); };</script> <?php if ($_POST) { ?> <?php $total = 0; ?> <?php foreach($mileage_data as $mileage) { ?> <?php $total += $mileage['mileage_amount']; ?> <?php } ?> <?php if (!empty($total)) { ?> <input type='button' id='print-page' value='Print' onclick='window.print();'> <div id="datatables-wrapper" style="max-height:500px;overflow:scroll;"> <p><?php echo htmlspecialchars($_SESSION['login']['customer_name']); ?></p> <p><?php echo htmlspecialchars($_SESSION['login']['company_name']); ?></p> <p class="total">Total Mileage From Dates Selected:<br> <b><?php echo $total; ?> Miles</b></p> <table class="printable-table"> <thead> <tr> <th>Mileage date</th> <th>Mileage amount</th> </tr> </thead> <tbody> <?php foreach($mileage_data as $mileage) { ?> <tr> <?php $mileage_date = new DateTime($mileage['mileage_date']); ?> <td><?php echo $mileage_date->format('d M Y'); ?></td> <td><?php echo htmlspecialchars($mileage['mileage_amount']); ?></td> </tr> <?php } ?> </tbody> </table> <?php } ?> <?php } ?> </div> </div> </div> <?php include(ROOT_PATH . 'inc/footer.php'); ?> <script language=JavaScript> <!-- //Disable right click script III- By Renigade (renigade@mediaone.net) //For full source code, visit http://www.dynamicdrive.com var message=""; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // --> </script>
  4. yes it is working but in my browser window the url is repeating i have screenshot video it. Recording #5.mp4
  5. Hi guys i am a complete novice learning. I want to automatically load a form page without using the submit button. i can get the page to load no problems but the url keeps refreshing in the browser window ? here is the code i am using. <h3>View Mileage.</h3> <form method="post" action="testmileage.php" name="mileage" id = "mileage"> <input type="hidden" name="start-date" value="2020-04-06"> <input type="hidden" name="end-date" value="2021-04-05"> </form> <script>window.onload = function(){ document.mileage.submit(); };</script>
×
×
  • 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.