so I have a a PHP Form handler that I have a hidden field in. I use this all the time in my header, however, I have not used it inside a php file. I access the jquery library, use $(document).ready(function () and have my variables inside, as well as getURLParameter("tid"), then ($tbody).html $("tbody").html($("tbody").html().replace(/{{transaction_id}}/g,replaceString));
I keep getting the error: Uncaught ReferenceError: getURLParameter is not defined
I'm probably missing something here, as I have not done this inside a PHP file before.
Should I use .php instead of .html?
Here is the snippet of code:
<?php } ?>
<table width="250"><tbody>
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script>
$(document).ready(function () {
var replaceString = "NO TID";
var urlTerm = getURLParameter("tid");
if (urlTerm.trim().length > 0 && urlTerm != "null") {
replaceString = decodeURIComponent(urlTerm).replace(/\+/g,' ');
}
$("input.transaction_id").html($("input.transaction_id").html().replace(/\{\{transaction_id\}\}/g,replaceString));
});
</script>
<tr><td><form id="signupform" class="signup_form" action="/testing-kirby.php" method="post"><div><div><input class="signup-name-area" style="height: 32px; width: 325px;" name="name" type="text" placeholder="Full Name"><br><br><input class="signup-email-area" style="height: 32px; width: 325px;" name="email" required="required" type="email" placeholder="email@example.com"><div style=" margin-top: 15px;"<center><input class="signup-button-2" style="background-color: red; height: 48px;" type="submit" value="Sign Petition"></center></div><input name="loc" type="hidden" value="header"></div></div><input name="tid" class="transaction_id" type="hidden" value="{{transaction_id}}"></div></form><p style="text-align: center;">Sponsored by:</p><p style="text-align:center;"><img src="https://wolfdaily.com/wp-content/uploads/2020/05/Wolf-Daily-Final-160h.png" width="200"></p></td></tr></tbody></table>
Thank you!