Hello and Merry Christmas to all!

Can anyone explain the correct behavior of a web application: what PHP is used for, what JavaScript is used for?

For now, I want to make a simple page with radio buttons, drop down lists and text areas. Some will have data from the database, and others will have input that data will be saved into the database.

My understanding is that I can use PHP for database operations and JavaScript for manipulating existing HTML objects. Can anyone confirm is this is correct and/or go into more detail?

Thank you.

6 Years
Discussion Span
Last Post by diafol

JavaScript runs client-side, can modify the HTML page, but can also communicate with a server (e.g. to retrieve fresh data).

PHP runs server-side and can do database operations, but also a lot more.



How should I populate the HTML with data fetched by PHP? is the following correct:

    echo "</td><td>";
    echo $row['some_db_column'];
    echo "</td><td>";

Edited by Buffalo101: n/a


Basically, although it may output invalid tags. Personally, I'd like to use a template engine (Smarty, RainTpl) for this.


As Prtaeas states, templaters should make things easier but they're not for everybody. Your code could spit out a ridiculously long table. Row tags need to be inserted from time to time to keep it a sensible width

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.