-3

I have a problem , I want to wirte HTML code that only refreshes the test , so just the code between de <div>...</div>

I was thinking to use some Javascript but I'm not sure this works in PHP , because my in HTML div there's PHP code.

My HTML code:

<HTML>
<HEAD>


</HEAD>
<BODY>

    <div id = "other div">
        <p> text </p> 
    </div>

    <div id="test">

        <?php refresh this code ?>

    </div>

</BODY>
</HTML>
il_raffa
  • 5,090
  • 129
  • 31
  • 36
jarle
  • 1
  • You might want to look into AJAX calls: https://www.w3schools.com/xml/ajax_intro.asp – Adriano Feb 28 '18 at 08:40
  • dublicate of https://stackoverflow.com/questions/6801001/jquery-to-refresh-div-content-generated-by-php – Luicy Feb 28 '18 at 08:43
  • Possible duplicate of [jquery to refresh div content generated by php](https://stackoverflow.com/questions/6801001/jquery-to-refresh-div-content-generated-by-php) – Luicy Feb 28 '18 at 08:43
  • 1
    Possible duplicate of [Refresh only a div in php](https://stackoverflow.com/questions/9691435/refresh-only-a-div-in-php) – Sangam Belose Feb 28 '18 at 09:03

1 Answers1

-1

PHP runs on the server. The only way to rerun it is to make an HTTP request.

There are (essentially) two ways to modify part of a page.

  • Use an iframe to make part of a page a separate document that can be loaded independently
  • Use JavaScript to manipulate the DOM. You can combine this with XMLHttpRequest or fetch to retrieve new data over HTTP.
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335