tsilenzio Posted August 23, 2008 Share Posted August 23, 2008 I have a form.. and after u press submit it submits values to the $_GET variable and the URL.. Well I was wondering if its possible to change the data AFTER the user clicks Submit.. but BEFORE the values actually get submited to the URL.. Basickly I want to strip coma's, and $'s from the textbox so in the URL it dosnt come up as %23 or what have u... Quote Link to comment https://forums.phpfreaks.com/topic/120970-_get-pre-stripping/ Share on other sites More sharing options...
cooldude832 Posted August 23, 2008 Share Posted August 23, 2008 Javascript onsubmit action would be better PHP can't adjust the query string for say on the load but you could fix the get VARS up and then header redirect with the fixed up (sorta sloppy) If you want a neat url maybe you should look int processing with POST unless your form needs GET for caching reasons Quote Link to comment https://forums.phpfreaks.com/topic/120970-_get-pre-stripping/#findComment-623644 Share on other sites More sharing options...
tsilenzio Posted August 23, 2008 Author Share Posted August 23, 2008 I want GET so u can copy and paste the link and have the same settings as the person who gave the link lol Quote Link to comment https://forums.phpfreaks.com/topic/120970-_get-pre-stripping/#findComment-623647 Share on other sites More sharing options...
marcus Posted August 23, 2008 Share Posted August 23, 2008 <script language="Javascript"> function chex(id){ var val = document.getElementById(id).value; var newval = val.replace(/,/g,''); var finished = newval.replace(/\$/gi,''); document.getElementById(id).value = finished; } </script> <form method="get" onSubmit="chex('txt');chex('txt2')"> <input type="text" name="txt" id="txt"><br> <input type="text" name="txt2" id="txt2"> <input type="submit"></form> tested and worked fine. Quote Link to comment https://forums.phpfreaks.com/topic/120970-_get-pre-stripping/#findComment-623652 Share on other sites More sharing options...
akitchin Posted August 23, 2008 Share Posted August 23, 2008 or, if you're worried about special characters in the URL, have a look at urldecode(). Quote Link to comment https://forums.phpfreaks.com/topic/120970-_get-pre-stripping/#findComment-623653 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.