Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.