HI,
how do i change tis code so when the php is done it gos to page running.php insted of the

" echo "1 record added"; " line ?

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$sql="INSERT INTO Persons (FirstName, LastName, Age)
VALUES
('$_POST[firstname]','$_POST[lastname]','$_POST[age]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con);
?> 

thanks , I know its simple however my 420 head will not compute it just at the moment lol.

Instead of echo "1 record added"; , include "running.php";

This should do the trick -

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
    header('Location: running.php');

    mysql_close($con);
    exit();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.