Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.