Sending a form to another site

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cobar
Forum Newbie
Posts: 3
Joined: Thu Jun 25, 2009 4:14 pm

Sending a form to another site

Post by cobar »

Hi

I want to send the content of a form, from one website to another but I cant find an example

This is the form on the site that receives the data

Code: Select all

<form>                      
<input type="radio" name="form" value="1" >Number</strong>      
<input type="submit" value="val1" />
</form>
And I don't know how to write the code on the first website in order to send the form to the second web site

Thanks
vtvstv
Forum Newbie
Posts: 10
Joined: Sun May 24, 2009 3:19 am

Re: Sending a form to another site

Post by vtvstv »

OK what is the action of the form you are sending to and what method does it use. Lets assume that the form action is processform.php and the method is post. Ill create an example form that has the action processform.php.

Code: Select all

 
<form action'processform.php' method='post'>                     
<input type="text" name="name" value="DATA1"  />
<input type="text" name="email" value="DATA2" />
<input type="radio" name="vote" value="DATA3" />
<input type="submit" value="val1" />
</form>
 
When you click the submit button on sitewithform.com it does the same thing as the following link (without spaces)

Code: Select all

 
sitewithform.com / processform.php ? name=DATA1 &email=DATA2 &vote=DATA3
 
So on yoursite.com if you process the form on your site with another php file that will create the dynamic link, like the one above, and will then follow that link using the php header command or meta reresh method this will process the data onto the site that you wanted to. I can go indepth with more code examples if you wish, but I wanted to make sure I was getting the jist of what you were saying first.
cobar
Forum Newbie
Posts: 3
Joined: Thu Jun 25, 2009 4:14 pm

Re: Sending a form to another site

Post by cobar »

Thanks, but is still doesn't work as I wanted, this is the code it works but only with radio and I want the form to be submitted when I load the page, and I have tried to do this with java and doesn't work

Code: Select all

<form name="vote" action="http://www.mysite.com/vote.php" method="POST">
<input type="submit" name="vote" value="1" >
<input type="submit" name="vote" value="Vote1" >
</form>
Post Reply