Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/28/2022 in all areas

  1. rifleName is incorrect That's what happens when you use multiple cases....
    1 point
  2. Why not query your database and put it all in an array like the one Barand showed you. Very little code doing it that way.
    1 point
  3. Use data attributes for the options <?php $data = [ [ 'id' => 1, 'rifleName' => '.308 Bolt action', 'em' => '225', 'gm' => '1350' ], [ 'id' => 2, 'rifleName' => '7mm magnum', 'em' => '300', 'gm' => '1575' ], [ 'id' => 3, 'rifleName' => '.243 LeverAction', 'em' => '215', 'gm' => '8725' ] ]; ?> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script type='text/javascript'> $().ready(function() { $("#menu").change( function() { let em = $(this).find("option:selected").data("em") let gm = $(this).find("option:selected").data("gm") $("#em").val(em) $("#gm").val(gm) }) }) </script> <select class='nameItems' id="menu" name="selection"> <option value="">Choose a Rifle</option> <?php foreach ($data as $row) { echo "<option value={$row['id']} data-em='{$row['em']}' data-gm='{$row['gm']}'>" . htmlspecialchars( $row["rifleName"] ) . "</option>"; } ?> </select> em:<input type="text" class="charge-type" name="em" id="em" value="0" disabled size="5"/> gm: <input class="charge-type" name="gm" id="gm" value="0" disabled size="5"/>
    1 point
  4. Don't use a redirect. Half of the point of a 404 page is that it returns a 404, and using a redirect makes it do something different. Why not just change the 404.php to be this new page? Wouldn't that be easier?
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • 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.