ultrasound0000 Posted February 12, 2009 Share Posted February 12, 2009 Hi, I need to pass form data from one form to another, different pages. The form has about 6 fields (i.e. first name, last name, etc). What is the best way to do this in PHP? I was thinking maybe put all the form values into an array and then pass them over to the next page? The trick is that I can use php for the first site/page, but not for the second (since that site does not have PHP installed). So this might have to be done via URL variables also, but I'm concerned about security. Any suggestions and examples would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/ Share on other sites More sharing options...
AdRock Posted February 12, 2009 Share Posted February 12, 2009 if you are submitting the form you could save all the variables in a session and then echo out the session variables in another form Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760411 Share on other sites More sharing options...
ultrasound0000 Posted February 12, 2009 Author Share Posted February 12, 2009 Do you have a specific example with using a session? I'm new to PHP so I have no idea. Also, the problem is that I won't be able to echo anything on the second page/form since it does not support PHP. Any other thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760412 Share on other sites More sharing options...
ultrasound0000 Posted February 12, 2009 Author Share Posted February 12, 2009 Anyone have any suggestion about my post? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760433 Share on other sites More sharing options...
AdRock Posted February 12, 2009 Share Posted February 12, 2009 You need to use session_start() at the top of any page that uses sessions. This is a very basic example. Thi <?php session_start(); $_SESSION['value1'] = $_POST['form_value']; ?> and if you want to echo the session you just echo $_SESSION['value1]; is there any reason why the other form is php supported? Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760436 Share on other sites More sharing options...
ultrasound0000 Posted February 12, 2009 Author Share Posted February 12, 2009 Hi AdRock, The second site does not have PHP installed and unfortunately it's something I don't have control over. So basically I would still need to find a solution for going from A to B where B does not support PHP but A does. Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760540 Share on other sites More sharing options...
premiso Posted February 12, 2009 Share Posted February 12, 2009 What does site B support? Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760545 Share on other sites More sharing options...
ultrasound0000 Posted February 12, 2009 Author Share Posted February 12, 2009 ASP Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760618 Share on other sites More sharing options...
premiso Posted February 12, 2009 Share Posted February 12, 2009 ASP You can use json_encode/json_decode if ASP as code for that. Basically that serializes an array for ajax usage. See if ASP supports json_decode or if you can find code to do that. If so that would be my suggestion either POST the json_encode version or send it via GET. Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760621 Share on other sites More sharing options...
ultrasound0000 Posted February 12, 2009 Author Share Posted February 12, 2009 Thanks Premiso I'll look into that. Curious: would it be possible to simple pass the form field values one by one as url variables? Or is that impossible? Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760659 Share on other sites More sharing options...
premiso Posted February 12, 2009 Share Posted February 12, 2009 Thanks Premiso I'll look into that. Curious: would it be possible to simple pass the form field values one by one as url variables? Or is that impossible? Yes you can, as asp should know how to handle "REQUEST" data. Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760758 Share on other sites More sharing options...
samshel Posted February 12, 2009 Share Posted February 12, 2009 following are the methods of transferring data between 2 pages of different sites - GET - send all variables in URL - POST - submit the form to the second page. These methods work irrespective of languages used for both pages. Languages will come into picture to READ variablesi n the second page of assing values to FORM variables before submit in first page. - Session will not work in this case as the 2 pages are in different sites and hence different domains. hope i make some sense. Quote Link to comment https://forums.phpfreaks.com/topic/144907-pass-form-data-to-another-form-using-array/#findComment-760819 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.