• hi I’m using the plugin Allow PHP Post and Pages. 3.0.4
    https://wordpress.org/plugins/allow-php-in-posts-and-pages/

    I need to enter the data via an html form,
    but it does not work, can you help me please?

    HTML form:
    <form action=”[php function=1]” enctype=”multipart/form-data” method=”POST” name=”test”>
    <label>€ <input class=”input” name=”apprezzamento” size=”06″ type=”number” placeholder=”Qui l’apprezzamento …” /></label>
    <input name=”B1″ type=”submit” value=”Invia” /></form>

    ([php function=1] is Shortcode Allow PHP Post and Pages)

    This is the text that I wrote inside the snippet

    PHP:
    //la stringa mysql_connect deve essere compilata con i dati relativi al proprio database
    // HOST = IP server Mysql
    // USER = Nome utente databse
    // PASSWORD = Password utente databse
    mysql_connect(“1X5.XX.1.X0″,”XXX_Admin”,”XXX-XXX”);//database connection
    // Qui sotto al posto di NOME_DATABASE, inserite il nome del vostro DB
    mysql_select_db(“XXX_XXX”);

    // recupero i valori si USERID e APPREZZAMENTO e li assegno alle variabili $current_user->user_login e $apprezzamento
    $current_user->user_login = $_POST[‘userid’];
    $apprezzamento = $_POST[‘apprezzamento’];

    //inserting data order
    $toinsert = “INSERT INTO Apprezzamenti
    (userid, apprezzamento)
    VALUES
    (‘$current_user->user_login’,
    ‘$apprezzamento’)”;

    //declare in the order variable
    $result = mysql_query($toinsert); //order executes
    if($result){
    echo(“<br>Inserimento avvenuto correttamente”);
    } else{
    echo(“<br>Inserimento non eseguito”);
    }

    • This topic was modified 9 years, 9 months ago by annalisalupo.
    • This topic was modified 9 years, 9 months ago by annalisalupo.

The topic ‘Shortcode Allow PHP Post and Pages’ is closed to new replies.