I’m new to PHP and very lost.
I’m working with HTML5, CSS3, jQuery and Bootstrap 4.
I have a total of 4 HTML pages on my website. In the first page there are 4 squares with text (let’s say A, B, C and D), user selects one of those squares and then presses the “Next” button. On click of this “next” user is taken to page 2 but this page needs to be updated according to user’s selection in page 1 (A, B, C or D). And similarly data from page 2 and page 1 needs to be taken to page 3.
I read about doing it via URLs, AJAX, PHP sessions and a few more things, but since I’m new at this I’m very confused.
Please guide as to how can I pass data among different pages?
EDIT: I’ve not used forms.
4
Answers
You can do this with use of
localstorage
First Page: (first.html)
Second Page: (second.html)
You can use local storage following example will definitely help you.
on HTML page 1:
On HTML page 2:
You can use cookies but storage is better option as page request is not sent to server.
There method depends on the purpose, this is one of the fundamental concepts and components in web development.