php - How to close a popup when a button is pressed? -


i want close page when button pressed. i'm using script add_address.php output list of email addresses message box , want output email addresses text box in send.php script

here code add_address.php:

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">     <head>         <meta http-equiv="content-type" content="text/html; charset=utf-8" />     <title>add email addresses...</title>     </head>     <body>     <form action="send.php" method="post">     <table>         <tr>             <td><textarea name="message" cols="50" rows="20"></textarea></td>          </tr>          <td colspan="2" align="left">            <input type="submit" name="send" value="add email" style="height:35px; width:100px">         </td>     </table>     </form>     </body> 

here code send.php:

<?php     if (!empty($_post['message']))      {         $emails = explode("\n", $_post['message']); // explode textarea on line break array         $email_str = implode(", ", $emails); // take each of emails , implode ,      } ?>  <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">     <head>         <meta http-equiv="content-type" content="text/html; charset=utf-8" />     <title>send email</title>     <link type="text/css" rel="stylesheet" href="style.css"  />     </head>     <body>     <form action="pr_send.php" method="post">     <table>          <!-- <tr>             <td>from:</td>             <td><input type="text" name="from"></td>         </tr> -->         <tr>             <td><input type="button" name="to" value="" style="height:24px; width:24px; background:url('addressbook.png'); border:none;" onclick="popup()"> to:</td>              <td><input type="text" name="to" value="<?php if (!empty($email_str)) { echo $email_str; } ?>" style="height:15px; width:650px"></td>         </tr>         <tr>             <td>subject:</td>             <td><input type="text" name="subject" style="height:15px; width:650px"></td>         </tr>         <tr>             <td>message:</td>             <td><textarea name="message" cols="90" rows="20"></textarea></td>         </tr>         <tr>             <td colspan="2" align="left">                <input type="submit" name="send" value="" style="height:35px; width:100px; background:url('send.png'); border:none">             </td>         </tr>      </table>     </form>     </body> <script type="text/javascript"> function popup()  {   window.open("add_address.php", "_blank", "toolbar=yes, scrollbars=yes, resizable=yes, top=100, left=500, width=400, height=400"); } </script>  </html> 

what snippets have show, allowed me output list of email addresses in message box , redirect send.php page output list of email addresses in text box without close it.

you shouldn't using window.open, instead should use way creating popup function jquery , css or use library created (tagit.js):

http://aehlke.github.io/tag-it/


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -