插入mysql时未定义的变量

I'm getting an undefined variable when trying to execute my code, the entry gets made in mysql but there is no data being inserted, obviously because of the undefined variable.

It was working...

Here's the message:

PHP Notice:  Undefined variable: title in /Applications/MAMP/htdocs/rfx/wp-content/plugins/rfx-manager/inc/rfi_page.php on line 154

Here is the code:

    <?php
    $wpdb->query("insert into ".$wpdb->prefix."forms set user_id=".$user_id.",
        title='".$title."');

    $title=$result->title;
    ?>

<form method="post" enctype="multipart/form-data" role="form">

<label for="title"><b>Enter title here:</b></label>
    <br>
    <input type="text" name="title" class="large-text" value="<?php echo (isset($title) ? $title : '') ?>" placeholder="Enter title">

    <input class="button-primary" type="submit" name="submit" value="<?php _e( 'Submit RFI for approval' ); ?>" />
</form>

Sorry guys, basically what the problem was is that one of the variables wasn't of course declared.

The snippet I gave was this:

$title=$result->title;

There were more variables like this stacked, one of them was giving a conflict, I basically went through them one by one adding each one and testing it, that surfaced the issue.

Hope this helps anyone.