Help - Search - Members - Calendar
Full Version: Tried to make my own weblog-system
Movable Type Community Forum > Additional Resources > Tips and Tricks
nikolaus
I'm trying to make a much simpler weblog-system, to use alongside MT.

I'm working on the input-script now, but I keep getting a parse-error on line 8 of process.php (which is the line that starts with "if(empty"))

Can anyone tell me what's wrong?

This is the input-field (form.html)

CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="input" method="post" action="put.php">
 <p>
   <input name="title" type="text" id="title">
 </p>
 <p>
   <textarea name="text" id="text"></textarea>
 </p>
 <p>
   <input type="submit" name="Submit" value="Submit">
 </p>
</form>
</body>
</html>


and this is the php-file that processes the form-data for insertion into the MySQL-table (process.php)

CODE
<?php
   /* Connecting, selecting database */
   $link = mysql_connect("localhost", "database", "password")
       or die("Could not connect");
   print "Connected successfully";
   mysql_select_db("database") or die("Could not select database");
    
if(empty($title) || empty($text)) exit("You didn't completely fill in the form!");
    // we're presuming here that you used 'title' and 'text' as the names for your form elements
$title = addslashes($title); $text = addslashes($text);
    // add slashes to the sent info so no escape characters are around (they'll possibly bust the script)
mysql_query("INSERT INTO my_news (title,text) VALUES ('$title','$text')");

?>
girlie
So you want loyal MT users to help you write a new weblog management system??

That's a bit much to ask, I think.
nikolaus
No, not at all! I'm sorry if I didn't explain myself too clearly.

I just wanted to test my skills in php-programming, so I tried to make a simple 2-file CMS: one that gets the information from the database, and one that provides the input for the database.

I'm just trying to improve my knowledge of php, in order to implement it into my MT weblog-magazine on www.zomp.nl


Nikolaus
gramcracker
Put {curly braces} around the exit statement.
nikolaus
Thanx a lot!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.