Jump to content

Form Input Submit Sends $_Get Request


nodirtyrockstar

Recommended Posts

I think I know the answer to this, but am hoping someone can help me.

 

Here is the button code:

 

<form action='writing.php' method='get'><input type='submit' class='sbmt' value='Journalism' name='lnk' /></form>

 

I want the button value to be "Journalism," but I would like it if the text sent in the $_GET request was shortened to four letters, for example 'jour'. I have other links like this one that have spaces in the text and I don't want that in my links.

 

My goal is to have a link that loads a new script and specifies a single four letter variable. I could use $_POST, but thought I would check with the experts and see if anyone had a suggestion that would work given the current set up.

 

Can anyone think of a way to make that happen?

Edited by nodirtyrockstar
Link to comment
Share on other sites

You'd need to use a JS that intercepted the POST, and rewrote the value.

Though, that said I don't see how this could ever be considered a good thing to do. You're only adding complexity to the whole process, and making it a lot more error prone. What happens if someone has deactivated, or cannot run JS, for example?

 

Far better to handle this on the server-side, and leave the URL as is, if you ask me.

Edited by Christian F.
Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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