• Hi again..

    I have added an Email input field and would like to store the users input in a variable so I can see the input user email together with the answer they gave in the database.
    I have added a new column in the database called author and added ‘author’ at the end of this:

    $exists = $wpdb->query( $wpdb->prepare("SELECT aid FROM $wpdb->democracy_a WHERE answer = '%s' AND qid = $this->id", $new_answer ) );
    		if( ! $exists )
    			if( $wpdb->insert( $wpdb->democracy_a, array( 'qid'=>$this->id, 'answer'=>$new_answer, 'votes'=>0, 'added_by'=>1, 'author'=>$author) ) )

    – with this, if
    $author = "[email protected]"
    [email protected]’ appears in the new column in the database next to the users answer.

    So I’m wonder how to get the value from my email input box and store it in a php variable that I can use here?

    My best guess so far has been $_POST[“name”] but no luck 🙁

    Thanks in advance!

    W

    https://ww.wp.xz.cn/plugins/democracy-poll/

Viewing 1 replies (of 1 total)
  • Plugin Author Timur Kamaev

    (@tkama)

    It’s not good idea to change plugin’s code, because you loose all changes during next plugin update.

    I don’t understand the question and what you want to achieve? Where you define the $author var?

    But, you can get new value of new “author” field with such SQL query:

    $wpdb->get_var("SELECT author FROM $wpdb->democracy_a WHERE answer = 'answer_text' AND qid = $questionID"); 

    P.С. Strongly recommend update the plugin upto last (4.6.6) version. There was a huge bug…

Viewing 1 replies (of 1 total)

The topic ‘Value from other input into democracy_a database’ is closed to new replies.