-1

This is head file of my program:

    <?php
  $obrazki = array('opona1.jpg', 'olej1.jpg', 'swieca_zaplonowa1.jpg',
                   'drzwi1.jpg', 'kierownica1.jpg',
                   'termostat1.jpg', 'wycieraczka1.jpg',
                   'uszczelka1.jpg', 'hamulec1.jpg');

  shuffle($obrazki);
?>
<html>
<head>
  <title>Czesci samochodowe  Janka </title>
</head>
<body>
</br>

<h1 style="color:blue;font-size: 4em; text-align:center"> Czesci samochodowe Janka</h1>
</br>

<h3 style="color:red;font-size: 2em; text-align:center"> Witamy na stronie Czesci samochodowe Janka!</h3>

<form action="glowna.php" method=post>
<div align="center">
<table width = 100%>
<tr>
<?php
  for ($i = 0; $i < 4; $i++) {
    echo "<td align=\"center\"><img src=\"";
    echo $obrazki[$i];
    echo "\"/></td>";
  }

?>
</tr>
<table>
</br>
<p style="color:red;font-weight:bold; text-align:center"> Prosimy o poswiecenie czasu i poznanie nas!</p>
</br>
<tr>
  <td align="center"><input type="submit" value="  Wejscie     "></td>
</tr>
</div>
</form>
</body>
</html>

File got extention *.php. It has to load some pics(opona1.jpg...) from $obrazki and if button "Wejscie" is pressed, programm in file glowna.php is called. Two problems: 1. If i try to change top of the program in such way

    <html>
<?php
  $obrazki = array('opona1.jpg', 'olej1.jpg', 'swieca_zaplonowa1.jpg',
                   'drzwi1.jpg', 'kierownica1.jpg',
                   'termostat1.jpg', 'wycieraczka1.jpg',
                   'uszczelka1.jpg', 'hamulec1.jpg');

  shuffle($obrazki);
?>

and to change extetion of head file from *.php to *.html - program doesn't work properly and doesn't show images at all? 2.All image files from $obrazki were of different images and had different names without 1s( like opona.jpg, olej.jpg, swieca_zaplonowa.jpg etc.)from the very begining. But if I tried to insert different images in my program and give them the same names (opona.jpg, olej.jpg, swieca_zaplonowa.jpg...) program started to show old(previous) pix even if i erased them totally. But when i changed names of all images from $obrazki adding 1s to names(like u see now) program started to show these new images.Why have I to do like that? Is this means html save information about image files somewhere? Thnx

adrian
  • 9
  • 2

1 Answers1

1

First, always try to use English words (like variables or files) in your code. It's easier to understand for readers which don't know your language.

  1. You can't change file extension from PHP to HTML. Only PHP files can execute PHP scripts. (Of course, you can configure your server to execute HTML file as PHP or add rule to htacess to swap extension from .php to .html)

  2. I think it's cache. You should always refresh page few times or use any method to clean cache after making changes (In chrome you can disable cache on the selected page)

K. Maliszewski
  • 333
  • 2
  • 16
  • 2
    Please note that Stack Overflow has an English only policy. Kindly refrain from using other languages in the comments. Thank you – Bhargav Rao Feb 05 '17 at 19:26
  • *"You can't change file extension from PHP to HTML. Only PHP files can execute PHP scripts"* - That isn't true. One can instruct their system to treat `.html` files as PHP. – Funk Forty Niner Feb 05 '17 at 19:46
  • and @adrian you were instructed by a moderator to keep your conversations in English. – Funk Forty Niner Feb 05 '17 at 19:48
  • @Fred if you looks at his code, you will know that he is very beginner, so I think he can't configure his server to execute html as php alone – K. Maliszewski Feb 05 '17 at 19:52
  • @K.Maliszewski If you look at the following Q&A http://stackoverflow.com/q/4687208/1415724 you will see that one can instruct their server to treat `.html` files as php. What you wrote in your answer is incorrect and IMHO, should either be removed (point #1) or edited. You are not only saying this to the OP but to future visitors to the question/answer. – Funk Forty Niner Feb 05 '17 at 19:58
  • @K.Maliszewski Oh, I just noticed the edit now; good show ;-) yes, that is better and clearer for everyone. – Funk Forty Niner Feb 05 '17 at 19:58