Jump to content

DulongC

Members
  • Posts

    14
  • Joined

  • Last visited

  • Days Won

    1

Community Answers

  1. DulongC's post in Dynamic dropdown within jquery function was marked as the answer   
    Okay, that's what is causing your issue then. a JS file cannot parse PHP, you will have to load the PHP variable into a JS variable to pass it to the JS file.
     
    i.e.

    <?php $s1 = mysqli_query($con, "select * from taxes"); $options = ''; while($s2 = mysqli_fetch_array($s1)) { $options .= "<option value='" . $s2['rate'] . "'>" . $s2['name'] . "</option>"; } ?> <script type="text/javascript"> var options = "<?= $options; ?>"; </script> <script type="text/javascript" src="myScript.js"></script> then in your JS file 

    var data = "<tr><td><input type='checkbox' class='case'/></td><td><span id='snum" + i + "'>" + count + ".</span></td";data += "<td><input class='form-control' type='text' id='productcode_" + i + "' name='productcode[]'/></td> <td><input class='form-control' type='text' id='description_" + i + "' name='description[]'/></td><td><input class='form-control' type='text' id='uom_" + i + "' name='uom[]'/></td><td><input class='form-control price' type='text' id='price_" + i + "' name='price[]'/></td><td><select class='form-control tax' id='tax_" + i + "' name='tax[]'><option value=''>Select Tax</option>" + options + "</select></td><td><input class='form-control quantity' type='text' id='quantity_" + i + "' name='quantity[]'/></td><td><input class='form-control discount' type='text' id='discount_" + i + "' name='discount[]'/></td><td><input class='form-control amount' type='text' id='amount_" + i + "' name='amount[]'/></td><td><input class='form-control tamount' type='text' id='tamount_" + i + "' name='tamount[]'/></td></tr>";
  2. DulongC's post in Parse String Help was marked as the answer   
    You can achieve this with preg_match_all 
    $success = preg_match_all("/{{edit:(.*?)}}/i", $html, $results); if ($success) { $results = $results[1]; //$results now contains all your edit values, you can do what you want with them. }
×
×
  • 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.