• L.S.
    Question, i have several textboxes on a page, the visitor puts text in this boxes like name etc…
    I got a button and when clicked i kick of a short code and then kick of a function in functions.php to insert the data into the dtabase, Short code in a script is not supported.
    Is there an other way

    many thanks,

    hanz

    • This topic was modified 4 years, 3 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    What plugin are you using for this?

    Thread Starter hanzter

    (@hanzter)

    Hello Steve,

    I’m not using a plug in.
    i’m using DOM, html and php in functions.php.

    hanz

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    what is the source of this shortcode and how are you using it?

    Thread Starter hanzter

    (@hanzter)

    wp does not allow to use a shortcode in a script it takes the parameter as literal not the value of the parameter. This value should then be used in functions.php to insert it in a database.
    I think i better make a form to get the dta the user fills in and then insert it into the database. I do not see an other way to get data from the page to the database.

    —this is in my page—–

    <script>
    function saverecordtodtabase() 
    {
    $qsorecord=document.getElementById("callsign").value;
     [qsologlogqsorecord $qsorecord]
    }
    </script>

    —this is in functions.php–just an echo for debugging willleter be an dtabase insert sql statement.-

    function qsolog_log_qso_record($atts) {
    global $wpdb;
    global $qsorecord;
    	$qsorecord=$atts[0];
           echo($qsorecord);
    }
    
    add_shortcode( 'qsologlogqsorecord', 'qsolog_log_qso_record' );
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘user input to databae’ is closed to new replies.