How can I delete characters from getting variables before sending form data?


I have a form where users enter the amount of rent to pay.

<form action="search_results.php" method="get">
  <input type="text" name="rent" value="$" />

I am using jQuery to keep the dollar sign in the field when the user enters their rent amount.

$('input[name=rent]').keyup(function() {
   $(this).val(function(i,v) {
     return '$' + v.replace('$',''); //remove existing, add back.

When the form sends to the search_results.php page, it sends to the url with the following get variable attached to it:

When the page begins to load, it shows the following error message:

Warning: mysqli_error() expects exactly 1 parameter, 0 given in /nfs/c09/h01/mnt/12345/domains/ on line 551

I'm pretty sure the error occurs because my sql statement is using the $_GET['rent'] variable to sort through all the listings with less than the rent amount entered, and it cannot do that with the dollar sign in it.

How can I remove the dollar sign character from the input field before it sends to the search_results.php page OR how can I remove the %24 from the url on the search_results.php page and then reload the page?

try this:

  $('input[name=rent]').val($('input[name=rent]').val().replace('$', ''))