nodirtyrockstar Posted December 3, 2012 Share Posted December 3, 2012 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? Link to comment https://forums.phpfreaks.com/topic/271520-form-input-submit-sends-_get-request/ Share on other sites More sharing options...
Christian F. Posted December 3, 2012 Share Posted December 3, 2012 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. Link to comment https://forums.phpfreaks.com/topic/271520-form-input-submit-sends-_get-request/#findComment-1397088 Share on other sites More sharing options...
requinix Posted December 3, 2012 Share Posted December 3, 2012 And in comes the old and very often overlooked element. <button type="submit" class="sbmt" value="jour" name="lnk">Journalism</button> Link to comment https://forums.phpfreaks.com/topic/271520-form-input-submit-sends-_get-request/#findComment-1397094 Share on other sites More sharing options...
nodirtyrockstar Posted December 3, 2012 Author Share Posted December 3, 2012 Yessssssss! @Requinix, totally worked! Thank you! Link to comment https://forums.phpfreaks.com/topic/271520-form-input-submit-sends-_get-request/#findComment-1397194 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.