MemphiS Posted July 4, 2007 Share Posted July 4, 2007 Can this be done? I have 2 sites and i wish to send data from one to another and i need a way of posting the info to my other site where it will save the data..It will happen everytime new data is submitted... Thanks Quote Link to comment Share on other sites More sharing options...
MemphiS Posted July 4, 2007 Author Share Posted July 4, 2007 bump Quote Link to comment Share on other sites More sharing options...
Petty_Crim Posted July 4, 2007 Share Posted July 4, 2007 I can answer this one. You can do this easily by using hidden fields. Heres an example echo "<input type='hidden' name='basketball' value='basketball'>"; Whatever that is posted to you will be able to gets its post variable ie in this case $_POST['basketball'] Just include that inside a form tag. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 If you use hidden fields you still have to use a submit button within a form. If you want to pass data from one script to another you can do this easily by using sessions. Hidden fields are very handy and I often use them for contact forms and guestbooks where I have the actual submit form and a verification page in the same script. Quote Link to comment Share on other sites More sharing options...
MemphiS Posted July 4, 2007 Author Share Posted July 4, 2007 Either of you havent answer what my question was really... Posting data from one website to another.. Sessions will not hold across to another webserver... I could simply copy the html from website two and place it on website one and have variables already set but i wish to auto "<form action="">"it... Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 Sorry, bit tired this morning, overslept and didn't read the "other sites" bit. One option you can use is to append the data onto the end of URLs and read it using a series of $_GET statements. Problem with this is that the data is very insecure and can be changed by the user. You can encrypt the URL but this is also insecure. All it takes is for someone to figure out your encryption routine. The other option is mentioned above by using hidden fields in a form although it means you'll have to use a submit button to have the data sent. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 <form action="http://www.website2.com/getdata.php" method="post"> <input type="hidden" name="secret" value="<?=$secret?>" /> <input type="submit" name="subsend" value="Please click to continue" /> </form> That sort of thing should work. Just use as many hidden fields as you want but this is also insecure. Someone needs only view the source to that page, make their own and like to the second web site so you'd have to check the referer of the link which yet again is also insecure as referers can be spoofed. Quote Link to comment Share on other sites More sharing options...
MemphiS Posted July 4, 2007 Author Share Posted July 4, 2007 Thanks for your reply i dont really wish to use $_GET or hidden input fields.. and there only insecure if you dont validate the data coming from them.. but anyway thanks for your suggestions i really just looking for a way to $_POST the data to another site Quote Link to comment Share on other sites More sharing options...
Yesideez Posted July 4, 2007 Share Posted July 4, 2007 This may be worth reading up on as I still haven't figured this out for myself: I've seen code writing data to $_POST variables but I remember reading somewhere that $_POST is read only - strange! Quote Link to comment Share on other sites More sharing options...
MemphiS Posted July 6, 2007 Author Share Posted July 6, 2007 bump Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 6, 2007 Share Posted July 6, 2007 if you share db then get the data from db and try to read something about curl that may solve dont want explain curl pretty long Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted July 6, 2007 Share Posted July 6, 2007 If there are some fields in the form like text fields,dropdown selection lists etc, you can use the JavaScript functions to do the action.When the value is entered in the textfield or some value is selected from the drop down list then there will be auto submission. Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 6, 2007 Share Posted July 6, 2007 you can use onclick onblur ionchange samlpe <input type='tets' onblur='javascript:document.submit();'> or search theres still more and better Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.