Ok, i did create the process.php and it does work fine, but still not sure how to deal with the header thing....!!
Process.php
<?php
// like i said, we must never forget to start the session
session_start();
// is the one accessing this page logged in or not?
if (!isset($_SESSION['basic_is_logged_in'])
|| $_SESSION['basic_is_logged_in'] !== true) {
// not logged in, move to login page
header('Location: login.php');
exit;
}
?>
<?php
$user = "root";
$pass = "1111";
$db_name = "currency";
$dbcnx = mysql_connect( "localhost", $user, $pass );
if ( !$dbcnx )
echo( "Couldn't connect to MySQL" );
mysql_select_db( $db_name , $dbcnx )
or die ( "Couldn't open $db: ".mysql_error() );
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>
<body>
<?php
if(isset($_POST['add']))
{
$countryname= $_POST['countryname'];
$currency = $_POST['currency'];
$query = "INSERT INTO countries (countryname, currency) VALUES ('$countryname', '$currency')";
mysql_query($query) or die('Error, insert query failed');
}
else
{
?>
<?php} ?>
</body>
</html>
newcountry.php
<?php
// like i said, we must never forget to start the session
session_start();
// is the one accessing this page logged in or not?
if (!isset($_SESSION['basic_is_logged_in'])
|| $_SESSION['basic_is_logged_in'] !== true) {
// not logged in, move to login page
header('Location: login.php');
exit;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Currecny System Login</title>
<style>
*{ FONT-SIZE: 8pt;
FONT-FAMILY: verdana; }
b { FONT-WEIGHT: bold; }
.listtitle
{ BACKGROUND: #425984; COLOR: #EEEEEE; white-space: nowrap; }
td.list { BACKGROUND: #EEEEEE; white-space: nowrap; }
</style>
</head>
<body onLoad="document.form.username.focus();">
<center><br><br><br><br>
<table cellspacing=1 cellpadding=5 width="300">
<tr>
<td class=listtitle colspan=3>Add New Field</td></tr>
<form method="POST" action="process.php">
<input type=hidden name=referer value="/">
<tr>
<td class=list align=left>Country Name:</td>
<td class=list colspan="2"><input name="countryname" type="text" id="countryname"></td></tr>
<tr>
<td class=list align=left>Currency:</td>
<td class=list colspan="2"><input name="currency" type="text" id="currency"></td></tr>
<tr>
<td class=list align=left>Image Path:</td>
<td class=list><input name="txtPassword" type="password" id="txtPassword"></td>
<td class=list><input type="submit" name="findimage" value="Browse"></td></tr>
<tr><td class=listtitle align=right colspan=3><input name="add" type="submit" id="add" value="Add New Country"></td></tr>
</form>
</table>
</center></body></html>