Page 1 of 1
To show a parameterless URL
Posted: Wed Dec 31, 2003 8:13 am
by anjanesh
I got a HTML file which contains a form that contains a textbox
txtName and a input button
butSearch and action is
Query.php
When I click the button it goes to
http://localhost/Query.php?txtName=anj&butSearch=Search
Everything is fine - I just dont want the parameters shown in the url. I want this to be seen in the address bar :
http://localhost/Query.php
I tried using hidden fields but hidden fields also get shown in the url.
I have seen this happen during registration etc - the url contains the php file but not the parameters.
Is there a way to do this ?
Thanks
Posted: Wed Dec 31, 2003 8:16 am
by Straterra
Are you using Post or Get? From the sounds of it, your using Get. Try Post.
Not mentioned GET nor POST
Posted: Wed Dec 31, 2003 10:02 am
by anjanesh
But I have not mentioned neither GET nor POST : Just this :
Code: Select all
<FORM ACTION="Query.php">
Name :
<INPUT name=txtName title="Searches for any keyword in the name">
<INPUT type="Submit" value="Search" name=butSearch>
</FORM>
Thanks
Re: Not mentioned GET nor POST
Posted: Wed Dec 31, 2003 10:14 am
by Straterra
anjanesh wrote:But I have not mentioned neither GET nor POST : Just this :
Code: Select all
<FORM ACTION="Query.php">
Name :
<INPUT name=txtName title="Searches for any keyword in the name">
<INPUT type="Submit" value="Search" name=butSearch>
</FORM>
Thanks
Try this code.
Code: Select all
<FORM ACTION="Query.php" METHOD="post">
Name :
<INPUT name=txtName title="Searches for any keyword in the name">
<INPUT type="Submit" value="Search" name=butSearch>
</FORM>
Posted: Wed Dec 31, 2003 11:09 am
by anjanesh
Yes thanks I tried this and
worked sucessfully. Now I have another problem in this code. If I click the Search button it'll work but if I hit enter in the textbox after typing some text the quesry sent is (this one without the method=post to know what is being sent):
http://localhost/Query.php?txtName=anj
and not
http://localhost/Query.php?txtName=anj& ... rch=Search
The name
SubmitBasicSearch is not being sent when we hit the enter key. I wrote a javascript method for onkeypress for that textbox and determine if the keyCode is 13 - if so then send the correct url but that doesn't happen.
Also Straterra : You told to include POST - I tried GET too. It worked as well so whats the difference b/w POST & GET here ?
Anyone ?
Thanks
Posted: Wed Dec 31, 2003 11:28 am
by Straterra
Get shows the stuff being submitted in the adress bar. Get is good for high data. Post hides the stuff and looks better, but tends to be a bit slower...I'm not very good with Javascript..but can you concantinate txtname=anj with &SubmitBasicSearch= with Search...
Posted: Wed Dec 31, 2003 8:13 pm
by m3rajk
also: get can be bookmarked, post can't
on top of that, default is get, therefore unless you mention post, html wiill ALWAYS use get