Can I Use PHP with Javascript in my HTML scripts? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Can I Use PHP with Javascript in my HTML scripts?

Captain CrunchCaptain Crunch Posts: 45Member

Hello,

I am new to PHP, but I know this sounds like a dumb question - but I wanted to know if you can use PHP and Javascript in the same HTML script file, as well as CSS, if you keep the languages separated by the tags ?

Second Question,

If I could run PHP and Javascript together - what would be executed first my Javascript or the PHP, because I know that Javascript will execute in the before or in the tags where the function is called, but what about PHP enclosed in tags , is it executed after or before Javascript?

I could explain further what I want to do with the two languages. I want to use PHP to handle things like mySQL queries or record data in the database, and I want Javascript to handle events like when a mouse is moved over a image to trigger other images to come up in framed window system.

Can this be done?

Thanks
K.J.Williams

Comments

  • pritaeaspritaeas Posts: 274Member
    : I am new to PHP, but I know this sounds like a dumb question - but I
    : wanted to know if you can use PHP and Javascript in the same HTML
    : script file, as well as CSS, if you keep the languages separated by
    : the tags ?

    Yes, possible.

    : If I could run PHP and Javascript together - what would be executed
    : first my Javascript or the PHP, because I know that Javascript will
    : execute in the before or in the tags where the function is
    : called, but what about PHP enclosed in tags , is it executed
    : after or before Javascript?

    Keep in mind that PHP is server-side scripting, and javascript is client-side scripting. PHP is executed when the page is rendered, and when it is loaded into the browser, the javascript is run.

    : I could explain further what I want to do with the two languages. I
    : want to use PHP to handle things like mySQL queries or record data
    : in the database, and I want Javascript to handle events like when a
    : mouse is moved over a image to trigger other images to come up in
    : framed window system.
    :
    : Can this be done?

    Yes. There is a lot of info online, in a lot of forums, so specific answer to specific problems can be found.
Sign In or Register to comment.