Java/Html help (2 posts)

  1. kzito
    Posted 3 years ago #

    Tried everywhere to find a solution for this but I guess it might be a little advanced for me, so apreciate some help, thank you.

    In this page we have a similar script that I m trying to use in worpress:


    When you put the values in the 2 fields and Hit calculate a new window will appear, and will be something like this depending on the values you put:

    The values passes from one page to another trough the url like it is in the bold part I pasted. My question is: How could one do something like this in wordpress when we don't have the .html pages.

    The question mark in the url after the .html? allows the values to be written without changing the page url. If I try this in worpress without the .html it will always return a page not found.

    I already tried to use an .html page convert plugin with no success. Is there other way to do this?

    Thank you very much.

  2. smigliorato
    Posted 3 years ago #

    You can do the whole thing in javascript, so it runs on the visitors computer. This way you won't have to deal with passing values.

    Or, you can use ajax to grab the answer from a script and change the page accordingly.


    WordPress pages are in html, it just looks a lot cleaner to not include that part. If you wanted to, you could.

    Also, the url parameters (after the ?) aren't necessarily related to not changing the URL.

    Here is the problem.

    Go to the WordPress Settings->Permalinks and you will see that wordpress works by passing values via url parameters like ?var=value&var2=othervalue. The default permalinks settings is http://example.com/?p=123.

    WordPress just takes the values after the ? in the url to find pages. Then, the permalinks settings takes those urls and converts them into the pretty urls that we are used to seeing.

    WordPress is probably trying to use your values to find a page. They don't make sense so you get a 404.

    You should modify the form, and the script that accepts it, to use POST. This way, it won't interfere with wordpress.

    You can avoid changing the URL by including the logic in the form.

    Like this (but replaced with real code ^_^)

    /** BMI page **/
    If post variables exist {
    Calculate and display stuff about BMI
    Else {
    Display BMI calculator form with the POST method

    If I've made any errors I please let me know

Topic Closed

This topic has been closed to new replies.

About this Topic