All pastes #745954 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-22 20:55 UTC
rendered paste body
This is the validationpart of a very very simple guestbook, the validation is through a simple dropdownlist with only three choices, and the right choice is 'mycketbra'. (Swedish for Very Good ;)) Somehow it doesn't work, I can't post anything to the DB this way... If I replace the elseif with else the script works fine.

<?php

}

elseif ($_POST[‘valbart’] == 'mycketbra') {

    // Adds the new entry to the database
    $query = "INSERT INTO sundberg_guestbook SET message='$message', name='$name', date=NOW()";
    $result = mysql_query($query);
}

// just added for the elseif statement
else {

    // Takes us back to the entries
    $ref = $_SERVER['HTTP_REFERER'];
    header ("Location: $ref");
}

?>