Saving data to another page

Saving data to another page
0.0 0

#1

Hi.

I have a index.php page with a dropdown with id = dd. When the search button on the page is clicked on, an html page gets auto rendered in code (lets say new1.html). I would like to take the selected value from the dropdown from the index.php page and pre-populate the same dropdown on the new1.html page with id = dd when the page loads. Nothing I do works. :

:frowning:

Please help.

Thank you!


#2

Hey @igitiit,
have you tried sending the data through a GET request? Meaning, you send the data you want by sticking it on the url.

https://www.w3schools.com/tags/ref_httpmethods.asp


#3

Edit: misread your post and thought you meant for search itself, but same logic applies (only it’s probably even easier, as there are limited options with the dropdown).

Edit: do you mean new page, or do you mean HTML on the existing page? These are completely different things.


The url for the search results page should be built from the search string (ie with a parameter that is the search string): example.com/search-results?search=whatever_I_searched_for_here.

I haven’t used PHP for a long time, so I can’t remember how it’s done, but it should be simple enough to put some logic in the results PHP file that checks that parameter and does whatever.