WordPress.org

Support

Support » Installation » pass this to variable to save to mysql?

pass this to variable to save to mysql?

  • i’m trying to save the current date into a mysql table.
    i tried this but it didn’t work, i suck at php.

    <php $date_variable_me = date('F j, Y'); ?>
     <input name="book_added_date" type="hidden" value="<?php echo $date_variable_me ?>" />

    if i just merely typed <?php date(‘F j, Y’); ?> it still didn’t work. ugh.

Viewing 2 replies - 1 through 2 (of 2 total)
  • So what table are you writing the data into?

    Might take a look at Creating_Tables_with_Plugins

    i created a new table called “data”

    question, how would I make this code activate when i clicked a submit button? I heard that hidden textboxes are a bad idea because of security, is this true?

    code:

    $welcome_name = "Mr. WordPress";
      $welcome_text = "Congratulations, you just completed the installation!";
    
      $insert = "INSERT INTO " . $table_name .
                " (time, name, text) " .
                "VALUES ('" . time() . "','" . $wpdb->escape($welcome_name) . "','" . $wpdb->escape($welcome_text) . "')";
    
      $results = $wpdb->query( $insert );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘pass this to variable to save to mysql?’ is closed to new replies.