I have a form with GET method with some inputs like this:
<input type="text" name="something">
<input type="submit" name="submit" value="Click here to submit form">
I don't want the url to bee
mypage.php?something=value&submit=Click+here+to+submit+form
I want to suppress the submit parameter in the url (should be like this: mypage.php?something=value).
I need only GET method please don't mention POST method.
Also you may mention to remove name="submit"
but i need it also to identify this submit.
Also if there is a input from which is empty i don't want to show
<input type="text" name="input1">
<input type="text" name="input2">
<input type="submit" name="submit" value="Click here to submit form">
input1
gets value but if input2
doesn't have value the i want url like
mypage.php?input1=value
Thanks
I have a form with GET method with some inputs like this:
<input type="text" name="something">
<input type="submit" name="submit" value="Click here to submit form">
I don't want the url to bee
mypage.php?something=value&submit=Click+here+to+submit+form
I want to suppress the submit parameter in the url (should be like this: mypage.php?something=value).
I need only GET method please don't mention POST method.
Also you may mention to remove name="submit"
but i need it also to identify this submit.
Also if there is a input from which is empty i don't want to show
<input type="text" name="input1">
<input type="text" name="input2">
<input type="submit" name="submit" value="Click here to submit form">
input1
gets value but if input2
doesn't have value the i want url like
mypage.php?input1=value
Thanks
Share Improve this question edited Mar 27, 2014 at 20:52 kero 10.7k5 gold badges43 silver badges52 bronze badges asked Mar 27, 2014 at 20:50 Sharif AhmedSharif Ahmed 931 gold badge2 silver badges10 bronze badges 3-
3
What is the technical limitation that is preventing you from utilizing
POST
? – esqew Commented Mar 27, 2014 at 20:52 - You can do it using javascript. Have the submit button outside the form, and when submit is clicked, using javascript submit the form. – dewd Commented Mar 27, 2014 at 20:54
- Is possible hidden value if field is empty with javascript, but if you need to get value from submit button, is not possible to hidden this value. – gabrieloliveira Commented Mar 27, 2014 at 20:59
2 Answers
Reset to default 6If you don't want the submit
parameter to show up in your GET
request URL, don't give it a name, and instead use id
or class
to identify it uniquely:
<input type="submit" id="submit" value="Click here to submit form">
I would remove form submit the and just turn it into a button. Then I would use jquery to submit the form and do any logic processing.
<input type="test" id="favoriteCheese" value="nacho" />
<button id="submit" value="Click here to submit form">Click here to submit form</button>
$("#submit").on('click', function () {
var data = {};
var favCheese = $("#favCheese").val();
if(favCheese.length > 0) {
data.favCheese = favCheese
}
$.ajax({
url : ".../mypage.php",
data : data,
type : 'GET',
...
})
})
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744782298a4593414.html
评论列表(0条)