Jump to content

[SOLVED] whats wrong here? OOP?


Branden Wagner

Recommended Posts

include("task.class.php");
$task = new Task;

if(isset($_POST['name']))
{
           $task->addTask($_POST['name']);
}
...

 

No matter what the addTask function will execute. The problem is it is putting it into a DB, so i endup with a bunch of blank entries with nothing but a timestamp everytime the page is visited.

 

Link to comment
https://forums.phpfreaks.com/topic/74265-solved-whats-wrong-here-oop/
Share on other sites

the problem is the the function gets run no matter what. whether or not $_POST['name'] is set.

the function works just fine.. but heres the code.

 

mysql_connect();

mysql_query("insert into $todo values($_POST['name'])");

 

 

the problem isnt with the function itself.. its with the IF statement.. or something. because the function SHOULDNT get executed at.

 

DEBUG !

try your condition

 

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

{ echo $_POST['name'].'test';

          $task->addTask($_POST['name']);

}

 

see if the function is executed even if the echo $_POST['name'].'test'; is not printed

or paste here the value for that ;D

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.