It wont work, the script might be messed up, please help / give a hint, i'll rep any help.


//////POST STATEMENTS///////////
$loginid = $_POST['loginid'];
$title = $_POST['title'];
$author = $_POST['author'];
$body = $_POST['body'];
$category = $_POST['category'];

$dbLink = new mysqli('', 'xxxxxxx', 'xxxxxxx', 'xxxxxxx');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
	$title = $_POST['title'];
	$title = str_replace("'", "&nbsp;", $title);
	$title = str_replace("`", "&nbsp;", $title);
    $title = nl2br(htmlspecialchars($title));
	if (strlen($title)>25)///IF TITLE IS MORE THAN 25
		echo "Title can't be more than 25 characters!<br>";
		elseif (strlen($title)<3)///IF TITLE IS LESS THAN 3
			echo "Title must be more than 3 characters!";
	$body = $_POST['body'];
	$body = str_replace("'", "&nbsp;", $body);
	$body = str_replace("`", "&nbsp;", $body); 
    $body = nl2br(htmlspecialchars($body));

	if (strlen($body)>10000)
		echo "The article contains more than 10 000 characters, please reduce the value.";
		elseif (strlen($body)<50)///IF TITLE IS LESS THAN 3
			echo "You have to write more than 50 characters.";
function makeClickableLinks($body) { 
$body = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="\\1">\\1</a>', $body); 
$body = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $body); 
$body = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $body);    
return $body; 
$body = makeClickableLinks($body);
if(!isset($category))die("Please select a category!");
////////////////////////////////INSERT INTO DB/////////////////////
$userid = $loginid;
        $query = "
            INSERT INTO `articles` (
              `loginid`,  `title`, `author`, `body`, `date`, `category`
            VALUES ('{$userid}',
                '{$loginid}', '{$title}', '{$author}', {$body}, {$category}, NOW()";
        // Execute the query
        $result = $dbLink->query($query);
			/*$createnew = "./articles/".$title.".html";	
			$createHandle = fopen($createnew, 'w') or die('Could not create the article, contact for instant help!');
			$fp = fopen($createnew,'a');
			$fwrite($fp, '<div class="title">'.$title.'</div><div class="author">'.$author.'</div>'); */

			} else echo "The article was not sent, if this problem persist please contact us!";


have u checked that is there any post data coming???
just echo every variable and check whether it is correct or not...then i can proceed further to help!!!

Be a part of the DaniWeb community

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