Skip to main content
June 4, 2009
Question

goto specific record after using insert form

  • June 4, 2009
  • 2 replies
  • 582 views

I am doing an insert form to add a company to my mysql database.  On the form, the user enters all the company information.  When they submit, I want to go to another form page where they can add their logo.  When you use the insert form wizard it ask where you want to go when done.  So this line is created

$insertGoTo = "addlogo.php";

I have tried  $insertGoTo = "addlogo.php?id"  . "=" . $_POST['id'] . ""; ,  $insertGoTo = "addlogo.php?id"  . "=" . $_GET['id'] . "";  $insertGoTo = "addlogo.php?id="  . "=" . $_POST[''id'] . ""; and  $insertGoTo = "addlogo.php?id<?php echo $rs_rowsrecordset['id']"";

the addlogo id is a record update page looking at the url for the id.  When the url goes it is http://www.mysite.com/addpage.php?id=&

When I put in a number of the ID it does what I want.

The ID is autoincrement from the database.

So, anyone know how I can pass that ID to the addlogo page? Thanks.

This topic has been closed for replies.

2 replies

June 8, 2009

Hai there. You can try mysql_insert_id() function. Scroll down to the insertion record code where u redirect users after they insert the record, u can see the line "$insertGoTo". At your page name addlogo.php, add like this "addlogo.php?id=" . mysql_insert_id() . ""; .

pziecina
Legend
June 4, 2009

I'm not certain if lastInsertId() is a pure pdo thing or a php function, (maybe David Powers can help there?), if not pure pdo this function retrieves the id number from the database for you.

The other way is to save your customers name into the session and then insert this into your query.

PZ