0

Hi,

I have built a form that send the info to the database. However I need the form to put the id of the entry into the url so I can get it on the next page. so that I can add more info.
The form goes over 2 pages. the first page is to add the info and the second is to add images.
So i need the id to pass through the url otherwise I cant put them both together in the same database.

If anyone could point me in the right direction, or has done this and is able to explain it, that would be awesome.

Thanks.

QWaz

4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by vaultdweller123
0

Hi,
Pls store the id value in a hidden variable.You can get this value while you submit the form.

0

pssubash is right. One way is to include a hidden field and use that to get the value:

<input type="hidden" id="id_number" name="id_number" value="<?php echo $id; ?>" />

You would retrieve this with $_POST["id_number"] , same as the other fields in your form.

Alternatively, however, if you really want to use GET for the id instead of POST, you can include the id in the action attribute of the form tag:

<form method="post" action="mysite.com/process.php?id=<?php echo $id; ?>">

You would retrieve this with $_GET["id"] .

0

Sorry, I think I may have asked the wrong question.

Let me explain again what I am trying to do:

A form is adding information into a MySQL Database and creating a NEW id value for that entry.

I then want get that NEW (unknown) "id" from that entry and get it into my url or post it to the next page.

So when the form is initally sent, I have no idea what the id will be. so I can't use a $id to send it as I don't know what the id will be.

I hope this makes more sense.

Do you know how to do that?

Cheers,

QWaz

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.