a popup page add record then affect mainpage

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

a popup page add record then affect mainpage

Post 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
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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.
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

Post 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
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post 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
Post Reply