Jump to content

server side vs. client side


ajetrumpet

Recommended Posts

You certainly need to do some reading to get a grip on how these things work.   PHP runs on the server and prepares the web page and the server then sends it to the client - with only HTML and JS/JQ code (and perhaps some other newer stuff) present.  PHP code embedded in html tags is just there (on the server) to provide some data for the html to display (although I prefer to embed php vars rather than actual code).  The webpage may have some js/jq code that gets triggered by events  that happen at the client level.  Eventually the html gets triggered to submit the page and its entries back to the server, triggering perhaps another PHP script (or the same one again) to run on the server and process the inputs received from the client.

Don't confuse the two.  Basically it's "PHP on the server; JS/JQ on the client".

Link to comment
Share on other sites

The PHP code embedded inside html tags is just generating more html code dynamically (usually containing data extracted from a database) which becomes part of the overall html page.

This then received by the browser (PHP's job is now done) on the client and rendered to display on the screen.

EDIT:

Your PHP code may look something like this

<html>
<body>
    <table border='1'>
        <tr>
            <th>IP ADDRESS</th>
            <th>PAGE VISITED</th>
            <th>PREVIOUS PAGE</th>
            <th>DATE</th>
            <th>TIME</th>
        </tr>
        
        <?php
            // printing table rows
            while($row = mysqli_fetch_row($sql)) {
                echo '<tr>'; 
                foreach ($row as $col) {
                    echo "<td>$col</td>";
                }
                echo "</tr>\n";
            }
            
        ?>
    </table>
</body>
</html>

and what your browser then receives is something like this

<html>
<body>
    <table border="1">
        <tr>
            <th>IP ADDRESS</th>
            <th>PAGE VISITED</th>
            <th>PREVIOUS PAGE</th>
            <th>DATE</th>
            <th>TIME</th>
        </tr>
        
        <tr><td>111.222.001.123</td><td>a.php</td><td>N/A</td><td>10/11/19</td><td>9:00am</td></tr>
        <tr><td>111.222.001.123</td><td>a.php</td><td>N/A</td><td>10/12/19</td><td>8:00am</td></tr>
        <tr><td>111.222.001.123</td><td>a.php</td><td>xyz</td><td>10/12/19</td><td>12:00pm</td></tr>
        <tr><td>111.222.001.123</td><td>a.php</td><td>N/A</td><td>10/12/19</td><td>1:00pm</td></tr>
    </table>
</body>
</html>

 

Edited by Barand
Link to comment
Share on other sites

1 hour ago, Barand said:

$50 per hour plus travel  time and expenses

that's ridiculous Barand!  custodians over here earn anywhere from $9 USD to $12 USD.  Given your age, I would say you're retired by now?  What in the world do you need anymore money for!?

Link to comment
Share on other sites

15 minutes ago, requinix said:

So you're saying you can find a custodian for $12 who will come clean your house for you?

not for cleaners that run their own businesses.  however, companies that clean homes generally hire employees at that rate, yes.

Edited by ajetrumpet
Link to comment
Share on other sites

that's horrible.  I drove a Toyota Yaris for years.  40 mpg for those guys!  Only the hybrids get better than that!  But i totaled all 3 yarises in 3 years time.  hit a deer with each one.  those are easy to damage tho...made of plastic.  Mercedes Benz cars...now those are tanks!  steel enforced!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.