faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input : URLs and Post or Get Methods

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 9 people (11%) answered Yes
Recently 1 of 9 people (11%) answered Yes

Entry

Is there a way to use POST method by url not using form?

Jul 24th, 2007 04:57
Igor Berger, Yes use javascript


Use JavaScript onchange event

<FORM NAME="find_friend">
<SELECT NAME="SelectURL" onChange="Select
(document.nav.SelectURL.options
[document.nav.SelectURL.selectedIndex].value)">
<OPTION VALUE="#"
SELECTED>Select Friend:
<OPTION VALUE="google.php?friend=Adam">
Adam
<OPTION VALUE="google.php?friend=Matt">
Matt
</SELECT>
</FORM>


Sorry guys this is a GET method and it does use a form.
But it is kind of cool that you can submit to a different url 
depending on a selection.

Try it out for fun. :)

Okay here is a way to post with a url.

<form 
name="google"
method="POST"
action="lets_party.php">
<input type="Hidden" name="Place" value="Disco">
<input type="Hidden" name="permission" value="yes">
</form>

<a  title="Bring Vanessa!"
 href="javascript:document.hotel.submit();">
 My Friends</a>

Try it out!

Will add some other nice ways to submit a form using a GET and POST 
methods.