10-02-2009, 03:44 AM
[eluser]jabga[/eluser]
Hi there.
This is my addnews.php
This is insertnews.php
There are following errors occuring when I click on the submit button
How can I add news from insert form easily? Please tell me
Hi there.
This is my addnews.php
Code:
<?php
class Addnews extends Controller {
function addnews()
{
parent::Controller();
}
function index ()
{
$this->load->view('insertnews');
}
This is insertnews.php
Code:
<html>
<body>
<?php $sql="INSERT INTO news (title, content, category)
VALUES
('$_POST[title]','$_POST[content]','$_POST[category]')";
?>
<form action="" method="post">
Title: <input type="text" name="title" />
Content: <input type="text" name="content" />
Category: <input type="text" name="category" />
<input type="submit" />
</form>
</body>
</html>
There are following errors occuring when I click on the submit button
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: title
Filename: views/insertnews.php
Line Number: 7
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: content
Filename: views/insertnews.php
Line Number: 7
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: category
Filename: views/insertnews.php
Line Number: 7
How can I add news from insert form easily? Please tell me