Jump to content

Building CMS


Talon21

Recommended Posts

Hi All,

 

I want to build my own CMS , first I built a Html form :

 

<form method="post">

<table width="700" border="0" cellpadding="2" cellspacing="1" align="center">

<tr>

<td width="100">Title</td>

<td><input name="title" type="text"></td>

</tr>

<tr>

<td width="100">Content</td>

<td><textarea name="content" cols="50" rows="10"></textarea></td>

</tr>

<tr>

<td width="100"> </td>

<td> </td>

</tr>

<tr>

<td colspan="2" align="center"><input name="save" type="submit" value="Save Article"></td>

</tr>

</table>

</form>

 

In first stage the form will have two fields Title and Content. Then I created a Script that supposed to add the page information to the database:

 

<?php

if(isset($_POST['save']))

{

  $title   = $_POST['title'];

  $content = $_POST['content'];

 

  if(!get_magic_quotes_gpc())

  {

$title   = addslashes($title);

$content = addslashes($content);

  }

  include 'library/config.php';

  include 'library/opendb.php';

 

  $query = " INSERT INTO news (title, content) ".

" VALUES ('$title', '$content')";

  mysql_query($query) or die('Error');

 

  include 'library/closedb.php';

 

  echo "Article '$title' added";

}

?>

 

But I'm keep on getting the Error message.

Link to comment
https://forums.phpfreaks.com/topic/110049-building-cms/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.