powaz Posted May 16, 2007 Share Posted May 16, 2007 i need send information form two different forms in to one .php page and then returning information to my page which i used to send information. what should i use include i think is not ok... may be something like self ? do you have same good suggestion ?! Thanx 4 answers. Quote Link to comment https://forums.phpfreaks.com/topic/51703-return-page/ Share on other sites More sharing options...
Psycho Posted May 16, 2007 Share Posted May 16, 2007 Your description is a little vague as to what you are doing and what you are wanting to accomplish. But, what I *think* you are doing is having two input forms that the user accesses in succession: Form1 - Form2. Then you want to go where? Form1 or Form2? Without further clarification I cannot be very specific, but here is a general idea of how you could handle it: Form1 should submit to itself. If the data does not pass validation then it should reshow the form with the posted data populated in the form. If the data does pass validation, then have Form1 do an include of Form2 (but do not have any input from the Form1 page) Form2 will load with all the Form1 data avaialble as post data. You could then display the Form2 fields and then for the Form1 data you could do a couple of things: 1) populate hidden fields with the Form1 data so when Form2 is submitted all the information is sent as POST data, or 2) save the Form1 data as session data and then the processing page could access Form2's data as POST data and Form1's data as session data. Personally I would go with option 1 and you could easily automate that with a small loop on Form2 like this: foreach ($_POST as $key => $val) { if ($key != 'submit') { echo "<input type=\"hidden\" name=\"$key\" value=\"$val\">"; } } Quote Link to comment https://forums.phpfreaks.com/topic/51703-return-page/#findComment-254751 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.