Problems posting with urlencode

J

Joseph Chase

I have the following form :


<form action="/auction/create/" method="post"><p><label
for="auction_created">Created</label><br /></p>
<p><label for="auction_user">User</label><br /><input id="auction_user"
name="auction[user]" size="30" type="text" value="" /></p>
<p><label for="auction_auction_title">Auction title</label><br /><input
id="auction_auction_title" name="auction[auction_title]" size="30"
type="text" value="" /></p>
<p><label for="auction_auction_url">Auction url</label><br /><input
id="auction_auction_url" name="auction[auction_url]" size="30" type="text"
value="" /></p>
<p><label for="auction_modification_rec">Modification rec</label><br
/><input id="auction_modification_rec" name="auction[modification_rec]"
size="30" type="text" value="" /></p>
<p><label for="auction_state">State</label><br /><input id="auction_state"
name="auction[state]" size="30" type="text" value="" /></p><input
name="commit" type="submit" value="Create" /></form>


I post the form data with the following calls:

params = urllib.urlencode({"auction[user]" :user,
"auction[auction_title]": auction_title,"auction[auction_url]": auction_url,
"auction[modification_rec]" :recommendation, "auction[state]=":
state,"commit":"Create"})

print "Storing...."
data = urllib.urlopen(self.baseUrl,params)


When I go and view the inserted record, the record exists, but the field
values are null. It is my thinking that the backend needs the "id" value
for each input value; how do I add that data to the urlencode() call?

When I utilize the above form, all is inserted and all of the field values
appear. What data am I not accounting for with my program; for its obvious
that the browser is sending something to the server that my application is
not.

Thanks.
 
S

Steve Holden

Fredrik said:
Joseph Chase wrote:




since the id isn't part of the form data set:

http://www.w3.org/TR/REC-html40/interact/forms.html#form-data-set

that's a bit unlikely.

printing the params string might help you figure out what's
missing.

If there's no chance of putting any debug statements into the processing
script you might consider using a proxy or submitting to a local server
to ensure that you are submitting what you think.

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,323
Members
48,007
Latest member
Elvis60357

Latest Threads

Top