Place label that is printed in PHP inside a div

Asked

Viewed 798 times

0

I want to show a record of my database. I used PHP to create, insert and select. The problem is that when I show a record, it does the echo within a div which is a Pop-up. The PHP code is inside the div Pop-up.

Example:

function select($dir, $base){
  ...
  echo "<br><label><b>$affiche[title]</b></label><br>"

}

 if(isset($_POST['insert']))//code is good here!
            {

               select($dir, $base); //affiche évènements 
            } 

And the html code:

<div id='abc' style="display:none"> </div>

    <div id="popup" style="display:none">

        <form method="POST" action="#">
           <input type=submit required  name='insert'>  
        </form>
    </div>
</body>

How do I show off div?

  • How? I didn’t see your problem...

  • The problem is that I want to print $affiche[title] (which is a field in my table) in another div. I don’t know if it has to do with get.

  • The label is placed on the popup div. I want to put off this div.

  • Rephrase the question because in the HTML section there is no PHP code but in the context of the question speaks of PHP code inside the div "popup". It is very confusing.

  • I want to show this label "echo "<br><label><b>$affiche[title]</b></label><br>"" outside the div "<div id="popup" style="display:None">" where it appears.

1 answer

1

You don’t have to echo, do it like this:

$div = "seutexto";

After you already have the variable value you can use it anywhere within the HTML (as long as it is after the variable assumed the value) using the tag:

<?= $div ?>

Ai you can put this tag outside your div, pointing to the variable.

See this topic here for best resolution.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.