WordPress.org

Ready to get started?Download WordPress

Forums

A way to see where PHP is rendered? (5 posts)

  1. WindyPoint
    Member
    Posted 3 months ago #

    So there's a gap in my knowledge of how wordpress works.

    It looks like wordpress is all php and that that php is run on the server, and then rendered out in html.

    What I'd like to know is if it is possible to see where that rendering is taking place, where the php gets executed and the html is generated.

    I'm trying to allow users to store and edit certain fields on the mysql database and it looks like the fields I'm currently using get this information as HTML and then somehow the HTML writes to the database and then ...the php calls it up again? or...?

    I'm using the woo commerce plugin and I'm trying to understand how it writes information to the database and how it calls that info back up again so that I can adjust it as needed.

  2. bemdesign
    Member
    Posted 3 months ago #

    This is going to really just be a higher-level overview...

    http://us2.php.net/manual/en/faq.general.php
    "PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly."

    When a request hits a server (like a browser asking to see a certain page), the server notes the request for a PHP file and filters that request to the PHP processor which then runs through the PHP code of the requested file(s) and executes the PHP instructions. Often times these instructions make requests to a database table to fetch information. Once all the data has been collected, the PHP processor puts everything back together to create an HTML page that then gets sent by the server back to the user agent (server to browser: here's the page you requested).

    Now saving data to a database requires at least three parts: an html form that has a specified form action, a server-side script that executes the form action, and, obviously, a database. So once a user has filled in the html form and clicks submit, the form-action triggers the server-side script to execute and take the data from the HTML form, put it into the appropriate format to execute a database query (or sends that info to another script/application which does this) and this information then gets sent to the database application to execute that query and save the data.

    So that's a high-level overview of what's happening.

  3. WindyPoint
    Member
    Posted 3 months ago #

    I see. It sounds like the PHP server-side script should then have SQL commands in it, to write new data to the database. Right?

    I am trying to find out which PHP file gathers the HTML data. In an example I found:

    <form method="post" action="claim.php" name="ClaimForm" id="ClaimForm" autocomplete="on">
        <fieldset>
            <legend>Contact Details</legend>
            <div>
                <label for="firstname" accesskey="U">Your First Name</label>
                <input name="firstname" type="text" id="firstname" placeholder="Enter your name" required />
            </div>

    etc...

    In that first line it mentions the PHP file as claim.php However, the woocommerce plugin is missing that action field:

    <form method="post">
        <h3>
            Billing Address
        </h3>
        <p id="billing_country_field" class="form-row form-row-wide address-field update_totals_on_change validate-required"></p>
        <p id="billing_first_name_field" class="form-row form-row-first validate-required">
            <label class="" for="billing_first_name">
                First Name
                <abbr class="required" title="required">
                    *
                </abbr>
            </label>
            <input id="billing_first_name" class="input-text" type="text" value="John" placeholder="" name="billing_first_name"></input>
        </p>

    etc...

    My question then is how to hunt this down. It seems like the environment is working just as you say, but I can not trace it.

  4. Evan Herman
    Member
    Posted 3 months ago #

    the data is being sent to be processed by claim.php

    Claim.php is probably located in an include folder or something similar within woocommerce.

  5. WindyPoint
    Member
    Posted 3 months ago #

    I am sorry, I must have been unclear. The first code is an example that makes sense to me and how html data should be sent to php. The code I am using is the second set. In it, there is no "action=" part. Actually, the entire html code seems to not mention any php file. I do not know how to find out where the data is sent with my situation in the second code set. This second set is actually being written by woocommerce (not me) and is working.

Reply

You must log in to post.

About this Topic