wowzuzz
wowzuzz

Reputation: 1388

Getting id in database to pull same data on next page

I have a form which is submitting a number of values. When inserted into my table in my database, it creates a unique id in my database (primary key). How would I check for that same unique id on the next page that I send the form action to?

Here is my code for my form. I don't want to confuse you guys with all of my form inputs so I just put these elements here.

<form action='selectItems.php' method='post' enctype="multipart/form-data" id='tradeForm'>
<input type='submit' name='submit' value='Go to next step'></input>
</form>

Would I append the id on the form action through GET? If so, how? I would appreciate any help.

Upvotes: 0

Views: 338

Answers (1)

Vamshi
Vamshi

Reputation: 186

Use

mysql_insert_id()

This function returns you last inserted id.

Retrieves the ID generated for an AUTO_INCREMENT column by the previous query (usually INSERT).

Upvotes: 1

Related Questions