Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTML Form process of POST by Safari



It is a *bad* practice to put query parameters in a form action URL.
All parameters should live inside the form as <input ... /> tags, if
you want the same parameter to be sent in each form just add it inside
the form as:

<input type="hidden" name="rm-login" value="" />

see my previous post on the subject.

-chris

On Thu, 24 Jun 2004 15:04:34 +0800, Leon Chen <email@hidden> wrote:
> 
> Thanks for all your help. Actually I noticed that odd thing in action
> and I also tried to take that query parameter out and tested it before
> I raised it here. I just want to hear from you guys on whether it is a
> good practice to put a query parameter at the action as I could not
> find the document to high light it.
> 
> Those HTML was generated by CGI from my friend and I am going to ask
> her what is the reason that she need to put such query in action.
> 
> 
> Leon
> 
> 
> 
> 
> On Jun 24, 2004, at 4:36 AM, Jeremy French wrote:
> 
> > Hi Leon,
> >
> > I tried you snippet below, and got the expected url -- namely, the one
> > specified by the "action" attribute. I also got the name-value pairs
> > for the submit button and hidden field.
> >
> > Since my test server is on port 8501, I edited your "action" url to
> > include that port number, as follows:
> >
> > action="http://localhost:8501/cgi-bin/test/cgi-bin/test?rm-login";
> >
> > Here's the packet that was sent by Safari to the server on port 8501,
> > as follows:
> >
> > ---
> > POST /cgi-bin/test/cgi-bin/test?rm-login HTTP/1.1
> > Host: localhost:8501
> > Connection: close
> > User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us)
> > AppleWebKit/125.2
> > (KHTML, like Gecko) Safari/125.8
> > Accept: */*
> > Accept-Encoding: gzip, deflate;q=1.0, identity;q=0.5, *;q=0
> > Accept-Language: en-us, ja;q=0.62, de-de;q=0.93, de;q=0.90,
> > fr-fr;q=0.86,
> > fr;q=0.83, nl-nl;q=0.79, nl;q=0.76, it-it;q=0.72, it;q=0.69,
> > ja-jp;q=0.66,
> > en;q=0.97, es-es;q=0.59, es;q=0.55, da-dk;q=0.52, da;q=0.48,
> > fi-fi;q=0.45,
> > fi;q=0.41, ko-kr;q=0.38
> > Content-Type: application/x-www-form-urlencoded
> > Content-Length: 34
> >
> > update=update+particular&rm=update
> > ---
> >
> > Note that no additional information was appended to the post url (see
> > first line of packet above); also note that the form field name-value
> > pairs appear correctly (see last line of packet above.)
> >
> > To view packets sent between Safari and the server, I used
> > INTERARCHY. See the following link for details:
> >
> > <http://www.interarchy.com/main/>
> >
> > Hope this info helps.
> >
> > Regards,
> >
> > - Jeremy
> >
> > On Jun 23, 2004, at 11:18 AM, Leon Chen wrote:
> >
> >> I am testing with the following HTML with a simple test CGI on my OS
> >> X machine:
> >>
> >>
> >> <?xml version="1.0" encoding="iso-8859-1"?>
> >> <!DOCTYPE html
> >>      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> >>       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> >> <html xmlns="http://www.w3.org/1999/xhtml"; lang="en-US"
> >> xml:lang="en-US">
> >> <head><title>Welcome</title></head>
> >> <body>
> >> <h3>Welcome </h3>
> >> <form method="post"
> >> action="http://localhost/cgi-bin/test/cgi-bin/test?rm-login";
> >> enctype="application/x-www-form-urlencoded" name="Form">
> >> <h4><input type="submit" name="update" value="update particular"
> >> /></h4>
> >> <input type="hidden" name="rm" value="update" /><div></div>
> >> </form>
> >> </body>
> >> </html>
> >>
> >> I found Safari behaves differently from IE and Netscape:
> >>
> >> - I run it in Safari.  I click the "update particular" button I got
> >> the URL like this:
> >> http://localhost/cgi-bin/test?rm=login?rm=update which obviously
> >> created error
> >>
> >> - When I run the same HTML on IE and Netscape I got the URL like this:
> >> http://localhost/cgi-bin/test?rm=update
> _______________________________________________
> web-development mailing list | email@hidden
> Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/web-development
> Do not post admin requests to the list. They will be ignored.
> 
> 


-- 
Chris Holland
http://chrisholland.blogspot.com/
_______________________________________________
web-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/web-development
Do not post admin requests to the list. They will be ignored.


References: 
 >HTML Form process of POST by Safari (From: Leon Chen <email@hidden>)
 >Re: HTML Form process of POST by Safari (From: Jeremy French <email@hidden>)
 >Re: HTML Form process of POST by Safari (From: Leon Chen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.