Forum Moderators: coopster

Message Too Old, No Replies

PHP form post

         

cmlarson

7:31 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



I need to post form results to a url outside of my domain, but remain on my current website so the user is never taken away. In the past, I've used the method described in this post: [webmasterworld.com...] . The problem now is that I have a new url I need to post to that can't accept url variables (doesn't like all the & signs). Is there a way to do a silent post of the form variables, but without using a data string?

coopster

6:53 pm on Aug 5, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, cmlarson.


I need to post to that can't accept url variables

...but that is what POST does. It makes no sense to POST if the receiver isn't accepting variables.

cmlarson

8:56 pm on Aug 5, 2005 (gmt 0)

10+ Year Member



I don't have access to the code that is accepting the data, so I don't know what they're doing. They just told me that I have to use a form post and not a query string. I tried sending the data as is described in the post I listed above and it didn't work. I then went and changed the action of the actual form to the same url, hit the submit button, and data was sent and received ok. I need to run the form data through some filtering to determine if the data is good or bad before I send it along, and only send it if everything passes. Plus, I want the user to view my thank you page, not the thank you page of the owner of the posting url.

coopster

12:48 am on Aug 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Well then that is exactly what is being described in the thread you referenced. You have a form, a user fills it out and clicks submit. You edit the values upon a submission and if all passes, you send a POST along down the line. Control is still in your script and you then offer up a confirmation.

cmlarson

1:54 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



The data sent in the post I referenced is formatted something like:?var1=monday&var2=tuesday&var3=wednesday

The place I am submitting the form to will not accept the '&' signs. If I submit the form like that, they don't accept it. If I put their form handler page in the action of the actual form and hit the submit button, they accept the data, but then I'm left with their thank you page. That's the way it works - I don't know why, but that's what I'm stuck with.

nkad05

2:19 pm on Aug 8, 2005 (gmt 0)

10+ Year Member



This is not a difficult problem. You could make a function that is called during onsubmit() to "build" the URL and pass it to the location property of a hidden frame.

coopster

3:43 pm on Aug 8, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are they using method="post" in their form-handler?

dlefree

1:40 pm on Aug 9, 2005 (gmt 0)

10+ Year Member



This sounds like an ideal situation for the use of the Client Url Library functions.

Check out:
[us2.php.net ]

A guide to remote POSTing without cURL can be found on this very forum at:
[webmasterworld.com ]

Best of luck with it!

coopster

1:52 pm on Aug 9, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That link is the very one discussed in the first message in this thread --
I know, it's easy to miss sometimes ;)

And welcome to WebmasterWorld, dlefree.