Page 1 of 1

a popup page add record then affect mainpage

Posted: Mon Jun 06, 2005 4:13 am
by valen53
hi all,

i have a form contain a lot of selectbox. Some of the selectbox need to do setup. when i press the button beside selectbox, it will popup a page which is setup that data. After keyin data and closed, the mainpage will get the data just keyin.

i quite difficult to describe it since my english also not very well, hope you understand.

any people done it before ? any reference ?

thanks for reply

Posted: Mon Jun 06, 2005 4:38 am
by JAM
If I understood correct... :wink:

There are various of ways. One way might be something like this:

Code: Select all

<form action="newpage.php" method="get">
<select name="test">
<?php
    for ($i = 1; $i < 20; $i++) {
        echo '<option value="'.$i.'">'.$i.'</option>';
    }
?>
</select>
<input type="submit" />
</form>
Pressing the button, sends the user to newpage.php, with the $_GET['test'] value in the URI.
( Example: http://www.example.com/newpage.php?test=4 )

Code: Select all

<pre>
<?php
    // example display. Do whatever here with .
    if (!empty($_GET)) {
        print_r($_GET);
    }
    // After done, forward again using header, example:
    // header("Location: ./index.php?value=".$_GET['test']);
    // ...or...
    // header("Location: ./index.php");
?>
</pre>
Just ideas and examples.

Posted: Mon Jun 06, 2005 5:23 am
by valen53
thanks reply

i describe again. i got a mainpage which is contain many selectbox. when i need to add new data for one of the selectbox, i press a button then will popup a new window.
So i can add data at that new window. After saved and close the new window, the mainpage will refresh to get new data. Something like phpmyadmin when edit the sql statement.

anyway thank u so much

Posted: Mon Jun 06, 2005 5:28 am
by malcolmboston
the only way to get page one to update from a seperate file called page 2 would be the use of javascript

i personally discourage this as it can break your application when javascript is disabled, the best method in my opinion is the aforementioned $_GET method