Skip to content
Advertisement

Access data in URL using GET and send it to database using POST

I am sending an id using the url. However, i can only access the $GET[‘id’] variable when the page loads. When I go on to submit the form, the variable is undefined. What could be the problem

JavaScript

Advertisement

Answer

When you build the form, the target should include the GET parameter too. This is how GET parameters are passed around. $_POST will be populated with the form fields, $_GET will be populated with whatever is in the url.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement