FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Post value from one site to another site.





AOP Web Development
Hello can i just like to ask if you can post a value from one site to another site for example..


www.site1.com/form.php will be submited to www.site2.com/post.php?

can it be? thanks
mathiaus
If you specify site2 in the action of your form tag, yes.
imagefree
Quote:
If you specify site2 in the action of your form tag, yes.


but i think login problem may occure (also the SID, User's username etc conflict will create problem). But may be you are correct because i dont have experience of it.
AftershockVibe
Hmm, I think what imagefree is getting at is that while you can do this with form submissions, you have to be aware of exactly what information is transmitted between servers.

So, basically ONLY things which are sent directly with the form are available - ie things you access with $_POST['VarNameHere'].

Anything like $_SESSION session variables will not be transfered because these are for use by the local server only.
SlowWalkere
AftershockVibe wrote:

Anything like $_SESSION session variables will not be transfered because these are for use by the local server only.


This is true, but you can fix this with by adding <hidden> items to your form.

Add something like this...
Code:

foreach ($_SESSION as $varname => $varval)
{
  echo "<input type=\"hidden\" name =\"$varname\" value=\"$varval\">
}


That will go through a loop adding every piece of the $_SESSION array to your form, and shoot it over to your new site. Then you just need the form processing page to pick out the important info and put it back into a new $_SESSION array.

- Walkere
AftershockVibe
Indeed Very Happy

Quote:
Add something like this...
Code:

foreach ($_SESSION as $varname => $varval)
{
echo "<input type=\"hidden\" name =\"$varname\" value=\"$varval\">
}


That will go through a loop adding every piece of the $_SESSION array to your form, and shoot it over to your new site. Then you just need the form processing page to pick out the important info and put it back into a new $_SESSION array.


Just don't try to transfer session IDs! They should always be generated by the server. Walkere's script will still be the simplest way to transfer any variables. Just remember not to assign the 'id' value on the other side.
manav
yup u can post values from form on one site to a php script on a different server....u surely can!!!
Related topics
What's Your site About
SMU: sigs for sale
post nuke problem
My new site
Alternate Realities
Changements to the Points/frih$ system (Discuss)
Buying Text links on your site
Anyone know how to make an email form?
frih$ and paypal
Submit your site free to a strong Directory and get Frih$!!!
Yeah sure another website thread... But mine is Graphics!!!
PR 3 Directory - Free Submission post your site here.
Advertise on my site
50fri$ Please help me with curl.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.