pass this to variable to save to mysql? (3 posts)

  1. homienick
    Posted 8 years ago #

    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.

  2. MichaelH
    Posted 8 years ago #

    So what table are you writing the data into?

    Might take a look at Creating_Tables_with_Plugins

  3. homienick
    Posted 8 years ago #

    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?


    $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 );

Topic Closed

This topic has been closed to new replies.

About this Topic