Hello,

Somehow this is not working. I tried pretty much everything.
I am also very new to PHP, but i made a nice CMS. Now I am making a website with some random flash-videos every time you refresh. This is what i got so far:

<html>
<head>
<title>Sydcul.com</title>
</head>
<body>
<h1>Sydcul.com</h1>
<h2>Warning: flashing images!</h2>
<p>It would be fun to turn on your sound.</p>
<?php
echo('This is visible, all stuff below is not. So the closing tags are not visible too.');
echo('<embed src="flash/' . rand(1, 5) . '.swf" type="application/x-shockwave-flash" width="320" height="240></embed>');
?>
</body>
</html>

I am not really sure how to implement HTML in PHP, so it is something really small i guess.

Try with double quotes, use statement given below, Php string is in double quote and html element values are in single quote

echo("<embed src='flash/" . rand(1, 5) . ".swf' type='application/x-shockwave-flash' width='320' height='240'></embed>");

You have done it OK, only a double quote (as part of html attribute value) is missing after 240.

echo('<embed src="flash/' . rand(1, 5) . '.swf" type="application/x-shockwave-flash" width="320" height="240"></embed>');

why don't you try like this (replace your php code with bellow code it works perfectly)

<?php

echo('This is visible, all stuff below is not. So the closing tags are not visible too.');

?>
<embed src="flash/<? echo rand(1, 5);?>.swf" type="application/x-shockwave-flash" width="320" height="240"></embed>


<?
  // remaining your code 
?>

Going to explain the above post more.

basically all your doing is stopping your php, doing html and re-entering php. PHP like many languages has the ability to jump in and out using tags

<?php echo'//Functionhere' ?>

As long as you open and close properly it's fine. You can also echo HTML :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.