Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Form Submit URL Formatting

Tags:

html

forms

php

get

I have a form which when submitted goes to the url "signup.php?username=xx" where xx is an input field. Instead of this I was wondering if I could get it to go to the following url "signup/xx" where xx is taken from the input field.

like image 306
John Doe Avatar asked Feb 12 '26 00:02

John Doe


1 Answers

You need to use Javascript and some type of .htaccess for that. But why don't you use POST instead of GET?

I don't want singup?username=sawny&password=1234 in my history.

EDIT:

I had done something like this:

$(document).ready(function() {
    $("submit[name='foo']").live('submit', function() {

        var usr = $("form input[name='user']").val();
        $("form input[name='user']").remove(); //Else it will be singup/usr?user=

        $("form[name='bar']").attr("action", "singup/"+ usr);
    });
});

and then the regexp @zero posted in a .htaccess file.

like image 196
Sawny Avatar answered Feb 14 '26 12:02

Sawny



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!