Hi,
From the code below, hopefully you can see what I am trying to achieve.
Basically I want the result printed where I choose to put the result anywhere on the page.
I keep getting the unexpected T_IF error on line 39, where am I going wrong here?
<html>
<head></head>
<body>
<?php
session_start();
$self = $_SERVER['PHP_SELF'];
$localhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$dbname = 'north';
$connect = mysql_connect($localhost, $dbuser, $dbpass);
mysql_select_db($dbname, $connect);
if(isset($_POST['submit']))
{
$id = $_POST['id'];
$title = $_POST['title'];
$description = $_POST['description'];
$keywords = $_POST['keywords'];
$_SESSION['id']=$id;
$_SESSION['title']=$title;
$_SESSION['description']=$description;
$_SESSION['keywords']=$keywords;
$query = "INSERT INTO URL VALUES ('','$id','$title','$description','$keywords')";
mysql_query($query);
$success = 'You have successfully updated your data';
}
$form.="<div style=\"border: 1px solid;padding: 10px 0 25px 0;\">";
$form.="<p>Database result:" . if(isset($success)) { print $success; }."</p>";
$form.="</div>";
$form.="<form action=\"$self\" method=\"post\" style=\"border: 1px solid;\" >";
$form.="<legend>";
$form.="<label>Page Name:</label> <input type=\"text\" name=\"id\"><br>";
$form.="<label>Title of Page:</label> <input type=\"text\ name=\"title\"><br>";
$form.="<label>Description: </label><input type=\"text\" name=\"description\"><br>";
$form.="<label>Keywords:</label> <input type=\"text\" name=\"keywords\"><br>";
$form.="<input type=\"submit\" name=\"submit\">";
$form.="</legend>";
$form.="</form>";
print $form;
?>
</body>
</html>