user2217076
user2217076

Reputation: 27

Pop Up Code in PHP

Is it possible to make a pop up window in this code?

<table background = "nb.png">

<tr>
 <td>
 <center>
  <?php

  if (isset($_POST["word"])) {
  if ($_POST["word"] == "boy" )
  {
    echo "Your answer is correct.";
  }
else
{
    echo "Sorry, you typed the wrong answer. Try Again!";
}
}
 ?>
 <span id="dummy" onclick="playSound(this,'vowels/boy.mp3');">
 <img src="pics/dipthongs/boy.jpg" width="400" height="250"> </li>
  </span>
 <form action="act_dip.php" method="post">
 <font color = "black" size="20"> <strong> Type the word: <input type="text" name="word"> </font>
 <input type="submit" name="check" value="Answer">
 </form> 
 </td>
 </span>
 </center>
 </tr>
 </table>

When I click the Answer button, the result appears so simple. Can I possibly do it in a pop up? Thanks!

Upvotes: 0

Views: 3035

Answers (1)

Lochemage
Lochemage

Reputation: 3974

Not through PHP, keep in mind that it is all processed by the server. By the time the client receives the page, all of the PHP is stripped out and replaced by code that can be interpreted by the client (such as JavaScript, HTML, and CSS). If you want a popup box, then you would have to design it using the client languages that are available.

Make an HTML div that is absolutely positioned to the center of the screen (or wherever you want), and then put all your form controls inside it. This should take a combination of HTML (to form the controls and view), JavaScript (to position it based on window size), and CSS (to provide the look-and-feel of the pop up).

Upvotes: 2

Related Questions