Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Can JAVA script or HTML be used on PHP 5 based website?

Posted on 2011-10-28
11
Medium Priority
?
330 Views
Last Modified: 2012-08-14
I have a PHP 5 based website with only PHP files. I am trying to use a JAVA script or HTML link (affiliate banner) on some of my website pages.
Can a JAVA script or HTML be used on PHP 5 based website? If so, can it be used as regular PHP code?
0
Comment
Question by:labradorchik
  • 3
  • 3
  • 3
  • +1
11 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 37046949
Of course.

html
<?php
echo "<a href='www.example.com'>link</a>";
?>

javascript

<?php
    echo "<script language=\"javascript\">alert('Hello!');</script>";
?>

Cheers
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 37047022
This should help get you started: http://php.net/tut.php
You might also like: http://www.sitepoint.com/books/phpmysql4/
0
 

Author Comment

by:labradorchik
ID: 37047090
Thank you for your comments!
I am sorry, but I am not a PHP developer... I am just looking for a straight answer, - YES or NO.
I have a JAVA script and HTML link, - can I copy and paste that script/code into my PHP files or not?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:happysunny
ID: 37047120
Yes, you can :)  Let us know if you need help doing so.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 37047127
No.

And given the question you might want to either read the introductory tutorial or consider hiring a developer to help you understand the design patterns.  As the great fire fighter Red Adair wrote, "If you think hiring professional help is expensive, just wait until you hire an amateur!"

PHP is a server-side scripting language.  It generates strings of information that are sent to the client browser.  These strings are usually HTML, JavaScript, CSS, images, text, etc.

This is a valid HTML string.

In PHP, you would write it this way:

echo "This is a valid HTML string.";

So as you can see it is fairly easy to make HTML and PHP play together, but as for a straight drop-in, the answer is No.
0
 
LVL 4

Expert Comment

by:happysunny
ID: 37047147
Very good, Ray :)

So the answer is no unless it is written a certain way, and yes if you write it correctly :)

Again, if you need help with combining them, then let us know.
0
 

Author Closing Comment

by:labradorchik
ID: 37047151
Thank you!!!  :)
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 37047224
lol
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 37047391
@happysunny: Exactly!

Thanks for the points and best of luck with your adventures in PHP! ~Ray
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 37047429
"So the answer is no unless it is written a certain way, and yes if you write it correctly :)"

For instance, as written in comment ID:37046949 ;-)
0
 
LVL 4

Expert Comment

by:happysunny
ID: 37048365
@Rau_Paseur @marqusG:  Yes, absolutely, and exactly :)  This was my very first answer; usually it's me asking the questions.  Promise I didn't copy, but I was just excited I knew the answer LOL
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question