Jump to content

$_GET, Pre-stripping


tsilenzio

Recommended Posts

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...

Link to comment
https://forums.phpfreaks.com/topic/120970-_get-pre-stripping/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/120970-_get-pre-stripping/#findComment-623644
Share on other sites

<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.

Link to comment
https://forums.phpfreaks.com/topic/120970-_get-pre-stripping/#findComment-623652
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.