0

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.

3
Contributors
4
Replies
7
Views
5 Years
Discussion Span
Last Post by diafol
0

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.

0

Thanks.

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

...
while($row=mysql_fetch_array($result)){
    echo "</td><td>";
    echo $row['some_db_column'];
    echo "</td><td>";
}

Edited by Buffalo101: n/a

0

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

0

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.