RuiPereira Posted November 2, 2022 Share Posted November 2, 2022 Hi Page 1(represents the list of produts selected) Page 2(pop up the list of produts, to select) I am in PAGE1, then when i need to select a produt opens PAGE2 Then i select a produt in PAGE2 and that page close In PAGE1 the product select will show My problem is how can i do that Quote Link to comment https://forums.phpfreaks.com/topic/315486-close-page-and-return-value-to-previous-page/ Share on other sites More sharing options...
Barand Posted November 2, 2022 Share Posted November 2, 2022 How are you storing which products the user has already selected? Quote Link to comment https://forums.phpfreaks.com/topic/315486-close-page-and-return-value-to-previous-page/#findComment-1602181 Share on other sites More sharing options...
RuiPereira Posted November 2, 2022 Author Share Posted November 2, 2022 (edited) The products are stored in mysql. The problem is transport the select code from Page2 to Page 1 already open. Edited November 2, 2022 by RuiPereira Quote Link to comment https://forums.phpfreaks.com/topic/315486-close-page-and-return-value-to-previous-page/#findComment-1602182 Share on other sites More sharing options...
Barand Posted November 2, 2022 Share Posted November 2, 2022 Why not store it when it is selected on page 2 then reload/refresh page 1 so it shows the revised list with newly selected item? Quote Link to comment https://forums.phpfreaks.com/topic/315486-close-page-and-return-value-to-previous-page/#findComment-1602183 Share on other sites More sharing options...
porta325 Posted November 3, 2022 Share Posted November 3, 2022 Without refresh you can use AJAX. With refresh you can do a POST request from page 2 to page 1 with the values you need. Quote Link to comment https://forums.phpfreaks.com/topic/315486-close-page-and-return-value-to-previous-page/#findComment-1602199 Share on other sites More sharing options...
RuiPereira Posted November 3, 2022 Author Share Posted November 3, 2022 Do you have any cod in ajax to test, because i cant refresh page 1 Quote Link to comment https://forums.phpfreaks.com/topic/315486-close-page-and-return-value-to-previous-page/#findComment-1602200 Share on other sites More sharing options...
Solution porta325 Posted November 3, 2022 Solution Share Posted November 3, 2022 https://www.w3schools.com/php/php_ajax_php.asp You basically return a result from another page without refresh with vanilla JS. The example uses an input but you can use whatever you want to send the request. https://code.tutsplus.com/tutorials/how-to-use-ajax-in-php-and-jquery--cms-32494 Here is the jquery method. I find it easier to go through. Quote Link to comment https://forums.phpfreaks.com/topic/315486-close-page-and-return-value-to-previous-page/#findComment-1602203 Share on other sites More sharing options...
RuiPereira Posted November 4, 2022 Author Share Posted November 4, 2022 Many tanks Quote Link to comment https://forums.phpfreaks.com/topic/315486-close-page-and-return-value-to-previous-page/#findComment-1602215 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.