PHP/mySQL Insert Form, Confirmation Message?

Hi,

I have put together the attached insert form to add records to my database, however I am looking to add a confirmation message once the user clicks submit.

The way I would like it to show is...

"Creation added, Click here to view this creation."

Can someone show me how to do this?

To view the creation the link would need to go to the page http://cawsearch.com/svr2008/view_caw.php?idx=$id

However the $id field is not filled in on the form as it is an auto increment field.

Thanks,
Paul.
<?
 
if(isset($_POST['submit'])){
$db = mysql_connect('', '', '') or die("Couldn't connect to the database.");
mysql_select_db('') or die("Couldn't select the database");
 
$console = $_POST['console'];
$name = $_POST['name'];
$attire = $_POST['attire'];
$type = $_POST['type'];
$creator = $_POST['creator'];
$formby = $_POST['formby'];
$image = $_POST['image'];
$thumbimage = $_POST['thumbimage'];
$image2 = $_POST['image2'];
$thumbimage2 = $_POST['thumbimage2'];
$image3 = $_POST['image3'];
$thumbimage3 = $_POST['thumbimage3'];
$video = $_POST['video'];
$formula = $_POST['formula'];
$date = $_POST['date'];
 
$sql = "insert into caws (console, name, attire, type, creator, formby, image, thumbimage, image2, thumbimage2, image3, thumbimage3,  video, formula, date) Values ('".$console."','".$name."','".$attire."','".$type."','".$creator."','".$formby."','".$image."','".$thumbimage."','".$image2."','".$thumbimage2."','".$image3."','".$thumbimage3."','".$video."','".$formula."','".$date."')";
$resultinsert = mysql_query($sql) or die(mysql_error());
}
?>
<form name="form1" method="post" action="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<table width="761" border="2">
  <tr>
    <td>Console:
	<select size="1" name="console" id="console">
	<option value="ps2">Playstation 2</option>
	<option value="xbox360" selected>XBOX 360</option>
	</select>
    </td>
  </tr>
  <tr>
    <td>
      Name:
      <input type="text" name="name" id="name"></td>
  </tr>
  <tr>
    <td>Attire:
    <input type="text" name="attire" id="attire"></td>
  </tr>
  <tr>
    <td>Type:
	<select size="1" name="type" id="type">
	<option value="Wrestler" selected>Wrestler</option>
	<option value="Diva">Diva</option>
	<option value="Non-Wrestler">Non-Wrestler</option>
	<option value="Original">Original</option>
	</select>
    </td>
  </tr>
  <tr>
    <td>Creator:
    <input type="text" name="creator" id="creator"></td>
  </tr>
  <tr>
    <td>Formula By:
    <input type="text" name="formby" id="formby"></td>
  </tr>
  <tr>
    <td>Image:
    <input type="text" name="image" id="image"></td>
  </tr>
  <tr>
    <td>Thumb Image: <input type="text" name="thumbimage" id="thumbimage"></td>
  </tr>
  <tr>
    <td>Image 2:
    <input type="text" name="image2" id="image2"></td>
  </tr>
  <tr>
    <td>Thumb Image 2: <input type="text" name="thumbimage2" id="thumbimage2"></td>
  </tr>
  <tr>
    <td>Image 3:
    <input type="text" name="image3" id="image3"></td>
  </tr>
  <tr>
    <td>Thumb Image 3: <input type="text" name="thumbimage3" id="thumbimage3"></td>
  </tr>
  <tr>
    <td>Video: <input type="text" name="video" id="video"></td>
  </tr>
  <tr>
    <td>Formula: <textarea rows="2" name="formula" id="formula" cols="20"></textarea></td>
  </tr>
  <tr>
    <td>Date Added: <input type="text" name="date" value="<?php echo date("Y-n-j"); ?>" size=60></td>
  </tr>
  <tr>
    <td><input name="submit" type="submit">
	</form>
	</td>
  </tr>
</table>

Open in new window

m0tSiEAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ashish PatelCommented:
So, you want to add confirmation on submit button or after the insert has been made?
0
m0tSiEAuthor Commented:
After the insert as been made if possible.
0
darron_chapmanCommented:
Place this right after your insert command

printf("<a href='http://cawsearch.com/svr2008/view_caw.php?idx=%d'>Creation added, Click here to view this creation.</a>\n", mysql_insert_id());

Go here for more info:
http://us.php.net/mysql_insert_id
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
m0tSiEAuthor Commented:
Awesome, cheers darron! :D
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.