I am in need of help on this one :( i cannot seem to figure out what i have done wrong, i set up my code just like in teh examples i read and i dont really see anything wrong with the logic (as far as i can tell) but the code will RETURN as data added successfully but i know better cause nothing shows up in teh database.

heres the html

<input type="hidden" name="cnotes" values="<?php echo $u ?>"/>
                              <textarea class="field span12" id="note_text" name="note_text" type="text" rows="9" maxlength="10000"></textarea>
                              <input id="add_note" type="submit" class="pull-right" name="add_note" value="Add Note"></submit>

this code is what i used to collect the data for the submission, i used a hidden input to get the value of the rom number for each entry in my table, then i just take the textarea and add that to the database, really im updating the database with that value being added to an already existing entry in my database, but this is where my issue starts.

In my sql line $note_sql it doesnt seem to really update anything

$note_sql = "UPDATE users SET customer_notes='".$customer_notes."' WHERE id='".$row."'";

here is the whole code

$con = mysqli_connect($host,$uname,$pass,$database) or die(mysqli_error($con));

$customer_notes                     = NULL;

if(isset($_GET['add_note']))
{
    $customer_notes                 = $_GET['note_text'];
    $row                            = $_GET['cnotes'];
}

// $sql = "INSERT INTO userprofile
//             (customer_notes)
//             VALUES
//             ('".$customer_notes."')";

$note_sql = "UPDATE users SET customer_notes='".$customer_notes."' WHERE id='".$row."'";

$result = mysqli_query($con, $note_sql);  
if($result){
    echo ("DATA SAVED SUCCESSFULLY");
} else{
    echo("Input data has failed Please go back and resubmit");
}

if anyone can help it would be GREATLY appreciated!

post the code for your form

what method are you using to submit the form?
did you try printing out your variables to make sure you have data?

$note_sql = "UPDATE users SET customer_notes='".$customer_notes."' WHERE id='".$row."'";

$result would return true even if $row = ''

commented: excellent advice for debugging +2

i apologize for not including this before

here is the full form code

<form action="addnote.php" method="get">
                            <div class="span12">
                              <h4 style="color:#1577a6;">Notes</h4>

                              <input type="hidden" name="cnotes" values="<?php echo $u ?>"/>
                              <textarea class="field span12" id="note_text" name="note_text" type="text" rows="9" maxlength="10000"></textarea>
                              <input id="add_note" type="submit" class="pull-right" name="add_note" value="Add Note"></submit>
                            </div>
                          </form>

and im glad you pointed out printing it cause this narrows it down a bit, theres no data being passed to my id element of my sql string

UPDATE users SET customer_notes='sdasdcsdfvsdfvsdfvdfsvsdfv' WHERE id=''

this is what i got when i printed out $note_sql

NOPE NOPE NOPE i apologize for wasting your time jstfsklh211 this was a stupid error and i should have seen it but i simply was not paying enough attention, NOW TO MAKE UP FOR IT!

ill explain what i did wrong and how i fixed this, you see when i echo out the value in the html part of the form it was actually not echoing anything because i was missing THIS ";" at the end of my line, this method entirely works now that i have managed to fix it but yeah that was my ONLY issue. again sorry for the mix up, but regardless jstfsklh211 thank you for you assistence.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.