I am trying to send over a variable which contains id of a user to another page.
First page is the form page where the user enter it’s details and as soon as the submit button is clicked the details are entered into the table,
next the first page redirects to a page where user’s asked to upload it’s display picture, and to store the path to that picture i need the id on that very page i.e. on the image upload page.
Can someone tell me how can i achieve this?
It occurred to me you may actually be asking how you can get the last inserted id from the recently inserted photo you’re adding via mysql. In that case you can use
(details at http://php.net/manual/en/function.mysql-insert-id.php)
(if you’re using mysqli http://www.php.net/manual/en/mysqli.insert-id.php)
to find the id. Do this after inserting and before closing the connection. Then pass the id along however when you redirect:
The id will then be available as a GET variable: $_GET[‘id’]
OR if you’re asking how you can get the id from a form (assuming PHP), do this:
The value of the first input box will be stored as $_GET[‘id’] or whatever you have as the ‘name’ attribute.