So. I have setup two pages following the W3Schools tutorial.
One with this code:
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$sql="INSERT INTO person (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)
?>
and the other with this
<html>
<body>
<form action="insert.php" method="post">
Firstname: <input type="text" name="firstname" />
Lastname: <input type="text" name="lastname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
their purpous is to insert data in the mysql db, and it works fine. Now i'd like that data which is beeing stored in the db to be shown on another webpage. I tried with this code:
<html>
<head>
<title>Show</title>
<body>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
echo $_POST["localhost . my_db"]
?>
</body>
</html>
it gives me no error, but not even any result... can you please help me?:queasy: