Solved

Change a get form to post action

Posted on 2003-10-24
11
260 Views
Last Modified: 2010-04-09
Hi,

This question is repeated elsewhere in a larger question - but if anyone can help me with this i might be able to progress the larger question.

Can this get form be converted to a post action?


<form method="get">

<input type="hidden" name="q">
<input type="hidden" name="query">

<input type="text" name="search" size="20" maxlength="255" ><br />

<input type="submit"style= "width:150;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value; this.form.query.value = '';this.form.action = ' http://www.google.com/search ';"> <br />


<input type="submit"style="width:150;text-align:center" value="Lycos" onclick="this.form.query.value = this.form.search.value; this.form.q.value = '';this.form.action = ' http://search.lycos.com/default.asp?lpv=1&loc=searchhp&query ';"> <br />

</form>

Thanks.
0
Comment
Question by:macuser777
  • 7
  • 2
  • 2
11 Comments
 
LVL 33

Accepted Solution

by:
shalomc earned 50 total points
ID: 9617742
Sorry, Google search does not support POST.
It can't be done.

0
 
LVL 4

Author Comment

by:macuser777
ID: 9617753
Thanks - that clear's that up! :)

0
 
LVL 7

Expert Comment

by:Xxavier
ID: 9617765
The form metid property can be changed like so

<form method="get" name="f1">

<input type="hidden" name="q">
<input type="hidden" name="query">

<input type="text" name="search" size="20" maxlength="255" ><br />

<input type="submit"style= "width:150;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value; this.form.query.value = '';this.form.action = ' http://www.google.com/search ';"> <br />


<input type="submit"style="width:150;text-align:center" value="Lycos" onclick="this.form.query.value = this.form.search.value; this.form.q.value = '';this.form.action = ' http://search.lycos.com/default.asp?lpv=1&loc=searchhp&query ';"> <br />

</form>
<form > 
<input type="button" name="q" onclick="f1.method='post'">
</form >
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 7

Expert Comment

by:Xxavier
ID: 9617775
but as stated of course google will not accept post.
0
 
LVL 4

Author Comment

by:macuser777
ID: 9617780
>Xxavier - i'm gonna try that right now - i just accepted the previous comment that it couldn't be done -

- Stick around - i'll sort the point s out

thanks
0
 
LVL 4

Author Comment

by:macuser777
ID: 9617794
Hey - you got me all excited for a minute there!

Still thanks for the info - which i will try out now....
0
 
LVL 4

Author Comment

by:macuser777
ID: 9617811
>Xxavier

Is it possible to use one text input box when one of the searches is a get form and the other is a post action.

That's really what i'm trying to do.

0
 
LVL 4

Author Comment

by:macuser777
ID: 9617852
http://oldlook.experts-exchange.com/Web/Web_Languages/HTML/Q_20777536.html

please check this out

(your points from this question are there as well Xxavier)
0
 
LVL 33

Expert Comment

by:shalomc
ID: 9617874
Hey,
Let's suppose that Google did support POST, and you want to POST to google and GET to Lycos.
Your form would look like this: (notice the Google button action)

<form method="get">

<input type="hidden" name="q">
<input type="hidden" name="query">

<input type="text" name="search" size="20" maxlength="255" ><br />

<input type="submit"style= "width:150;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value; this.form.query.value = '';this.form.action = ' http://www.google.com/search '; this.form.method= 'POST';"> <br />


<input type="submit"style="width:150;text-align:center" value="Lycos" onclick="this.form.query.value = this.form.search.value; this.form.q.value = '';this.form.action = ' http://search.lycos.com/default.asp?lpv=1&loc=searchhp&query ';"> <br />

</form>
0
 
LVL 4

Author Comment

by:macuser777
ID: 9617898
>shalomc

that's interseting - i noticed the button action

I'm going to try that in reverse, ie form method = post action, and then ; this.form.method ='get'; for my google search.

that would solve my problem posted above if i can make it work.

i'll try and put it together now

0
 
LVL 4

Author Comment

by:macuser777
ID: 9617908
Nope

this is what i tried - it doesn't send the google request to google. It just sends it to apple.


<FORM method=post action="http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/70906/wo/AO49YhxmiP193DkmmSA2MqIKqmc/0.0.7.1.0.5.11.1.0.1">

<input type="text" name="0.7.1.0.5.11.1.0.1.4" size="24" maxlength="255"><br />
         
<SELECT name="0.7.1.0.5.11.1.0.1.12">

<OPTION value="0">All </OPTION>
<OPTION value="1">Hardware</OPTION>
<OPTION value="2">Accessory</OPTION>
<OPTION value="3">Software</OPTION>
</SELECT>

<input type="submit"style= "width:77;text-align:center" value="Apple Store" > 


<input type="hidden" name="q">

<input type="submit"style= "width:150;text-align:center" value="Google Search" onclick="this.form.q.value = this.form.search.value;
this.form.query.value = '';this.form.action = ' http://www.google.com/search ';this.form.method ='get'; "> <br />


</form>
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
FIELDSETs and LEGENDs in email markup 1 23
help squeezing some space out in this site 9 31
How would I do a website like this? 5 54
Make Line Items Look Good Over Mobile 2 52
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now