what i am trying to do is that when i click the "List of Checks button" beside the text box check no. a pop up window will be displayed containing the data from the database(somehow i already managed to do that)
what i can't do is that i want to pass the value of the selected check no to be passed to the parent form in the check no text box.
it will be like the values of the check no column can be clicked and when the user selects a particular check no it will be passed to the original form and the pop up window will be closed.
can anyone help me.
Expand|Select|Wrap|Line Numbers
- //this is my code for my form.php:
- <html>
- <head> <title> </title>
- <script src="../javascript/list.js"> </script>
- </head>
- <body>
- <form action="" name="addcashadv" method="post">
- <table class="mytable" align="center">
- <tr><th colspan="3"></th></tr>
- <h2 align="center"> Add Cash Advance </h2>
- <tr>
- <td>Check Number:</td>
- <td>
- <input type="text" name="chekno" value="" />
- <input type="button" onClick="List()" value="List of Checks">
- </td>
- </tr>
- <tr>
- <td>Employee Id:</td>
- <td>
- <input type="text" name="empid" onClick="" value="" />
- </td>
- </tr>
- <tr>
- <td>Full Name:</td>
- <td>
- <input type="text" name="fullname" value="" />
- </td>
- </tr>
- <tr>
- <td>Travel Order No:</td>
- <td>
- <input type="text" name="travelorder_no" value="" />
- </td>
- </tr>
- <tr>
- <td>Remarks:</td>
- <td>
- <textarea name="Cashadvremarks"></textarea>
- </td>
- </tr>
- <tr>
- <td></td>
- <td>
- <input type="submit" name="Submit" value="Submit" /> <input type="reset" value="Reset">
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- //this is my code for the viewchecks.php
- <html>
- <head>
- <title></title>
- <link rel="stylesheet" a href="stylesheets/style.css" type="text/css"/>
- </head>
- <body>
- <?php
- include "classes/pgsql_db.class.php";
- include "classes/checks_class.php";
- $conn = new pgsql_db();
- $checks = new checks($conn);
- $sort_select_array = array("Check No.", "Check Date", "Amount", "Payee");
- $cdata = $checks->getChecks(); # get_results
- ?>
- <h2>Checks</h2>
- <table id="checksTable" table border="1" cellpadding = "3" class="mytable_data">
- <?php include "layouts/table_header.php"; ?>
- <?php
- if(!empty($cdata)){
- foreach($cdata as $data)
- {
- echo "
- </tr>
- <td width='70'>".$data->checkno."</td>
- <td width='110'>".$data->checkdate."</td>
- <td width='100'>"."P ".$data->amount."</td>
- <td width='400'>".$data->payee."</td>
- </tr>";
- }
- }else{
- echo "<p class='error italic'>There are no checks.</p>";
- }
- ?>
- </table>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- //and this is my code for my JavaScript for pop-up
- function List() {
- window.open( "viewchecks.php", "myWindow",
- "status = 1, height = 600, width = 800, resizable = 0" )
- }