html - How do I call an array inside a session array in this 3 part PHP registration form
463
People are also looking for solutions to the problem: Protection against unauthorized redeployment of PHP applications
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.
Find the answer in similar questions on our website.
Answer
Solution:
The values of your checkboxes are stored in an array in $_POST, and you'll need to loop over them to get a value for each:
In order to pop up a warning regarding refreshing the page, you'll want to use
window.onbeforeunload
somewhere in your javascript. Browser compatibility for this is patchy, and might not give you the result you want.Stack Overflow answer for pop-up on refresh
MDN web docs for window.onbeforeunload (compatibility)
Regarding coding style:
Coding style is a matter of opinion, so we can't really give you an answer on Stack Overflow. Your code's readable and understandable which is a really good start. I think, generally, the consensus is use a lot of comments and more controversially use some frameworks.
Just keep in mind that the secondary goal in programming, aside from making a thing that works, is producing code which other programmers can read, and code which will make sense to you when you come back to it in 6 months time after having completely forgotten about it.