Send a variable from PHP to HTML?

1

I have a problem. I need to send a variable of a file in PHP on my site1, to an html file on my site2. this is the code that I have so far

PHP site1 =

header ('Location: https://www.sitio2.xyz/ads/ad1/ad'.$variable.'.html');

this is the HTML

<META HTTP-EQUIV="REFRESH" CONTENT="0;URL=https://ejemplo.com/$variable">

Any way I can do it?

    
asked by Luis Cesar 05.09.2018 в 14:21
source

2 answers

3

You can create a PHP block within HTML, the abbreviated form is not usually compatible in different versions.

<META HTTP-EQUIV="REFRESH" CONTENT="0;URL=https://ejemplo.com/<?php echo $variable; ?>">
    
answered by 05.09.2018 в 14:45
1

I imagine that you will build the html from the php file that returns the answer. In that case, you can embed php code in the html lines by <?php echo $variable; ?> or <?= $variable ?> , which is an abbreviation of the first. For example, in your case:

<META HTTP-EQUIV="REFRESH" CONTENT="0;URL=https://ejemplo.com/<?= $variable ?>">
    
answered by 05.09.2018 в 14:41