• Hi,
    let me start by saying that I am learning so most probably my question will sound quite dump
    I am trying to implement into my WordPress page some special form.
    What I need
    In a page a form with 2 text fields and a submit button
    After submit it should return the sum of the length of the 2 strings either in the same page or in a new page, using same template as rest of the site

    I did a lot of reading and honestly I quite confused among “create child theme” “modify function php” “use form plugin” etc
    My preferred solution would be not to use a plugin or at least use as only a plugin like “PHP Code Snippets” and integrate with some php so to have enough flexibility

    So 2 questions:
    – pls point me to right direction
    – Suggest where I can learn specifically about wordpress and php code – in particular forms that return a result to be printed in a page

    • This topic was modified 2 years, 10 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 3 replies - 1 through 3 (of 3 total)
  • What are you actually trying to achieve here? If I’m right reading what you’ve said, you want to have two text fields, and thendisplay the number of charaters in each text field, or the sum of those values?

    To be honest, if that’s all you want to do I’d set that up using JavaScript and not PHP. It’s very simple to create a new shortcode that will output the form, and some JavaScript code for it. Just set the submit button to trigger the calculations in JavaScript and display the values on the same page. That way there’s no form submissions, no server-side interaction and no extra layers that realyl won’t do anything extra in this situation.

    Thread Starter wpvale

    (@wpvale)

    Hi Catacaustic,
    thanks for your replay. Actually yes, what I need to do is more complex, I will have to manipulate the strings and possibly even store the values in the db

    But what I am focusing here is to learn the correct way to collect data from a form, manipulate data in the back end and output a result in a WordPress page

    So yes, learn exactly form submissions, server-side interaction and extra layers

    So if I can set up what I described (form, php calculation, output) then I will understand the framework and I can evolve from there

    • This reply was modified 2 years, 10 months ago by wpvale.
    Thread Starter wpvale

    (@wpvale)

    Recap:
    I am not clear what should I call from the front end: must be functions.php? Must be from the child theme? Can be another php and if so where is going to be stored?
    And also how do I call the result page in wordpress and pass the sum value?

    thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create special form in WordPress’ is closed to new replies.