| | |
PostBack method on Page Refresh
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I cant explain to you everything about sessions but I can give you an example, that will hopefully solve your problem.
Understand the logic behind it now?
Let me know how you go.
PHP Syntax (Toggle Plain Text)
// PAGE 1 session_start(); $_SESSION['abc'] = "2"; // PAGE 2 session_start(); echo $_SESSION['abc];
Understand the logic behind it now?
Let me know how you go.
"You never stop learning." - OmniX
•
•
•
•
I cant explain to you everything about sessions but I can give you an example, that will hopefully solve your problem.
PHP Syntax (Toggle Plain Text)
// PAGE 1 session_start(); $_SESSION['abc'] = "2"; // PAGE 2 session_start(); echo $_SESSION['abc];
Understand the logic behind it now?
Let me know how you go.
in my example you clearly see, i take '2' as userinput not static input..!!!
//now page1
session_start();
$_SESSION['abc'] = ??? // how will you collect value of userinput
without sending it anywhere..!!
<input type='text' value="echo $_SESSION['abc'] " name="abc">
<!-- you dont know what user going to input.. -->
I hope now you get what exactly i want..!!!
Last edited by nish123; May 29th, 2009 at 3:03 am.
•
•
•
•
is it possible to have Postback method on page Refresh.??
(Hold the values of a form on page refresh..!!)
State management : home-made measures needed to preserve the state. Traditionally, statlessness hav been overcome with use of cookies, session, hidden fields, sticky form, and query string.
Here is an example code for everything to solves your questions:
You understand the logic? If not do some research?
php Syntax (Toggle Plain Text)
// Page 1 session_start(); // Starts the session <input type="textbox" name="textbox_name" /> // User enters 123 $_SESSION['textbox_session'] = $_POST['textbox_name']; // Page 2 session_start(); // Starts the session echo $_SESSION['textbox_session'];
You understand the logic? If not do some research?
"You never stop learning." - OmniX
The logic behind the code answers all his questions.
If he has further questions he just needs to ask.
adatapost > If you have nothing positive to add best not post than to be thought an idiot.
If he has further questions he just needs to ask.
adatapost > If you have nothing positive to add best not post than to be thought an idiot.
"You never stop learning." - OmniX
•
•
•
•
Here is an example code for everything to solves your questions:
You understand the logic? If not do some research?php Syntax (Toggle Plain Text)
// Page 1 session_start(); // Starts the session <input type="textbox" name="textbox_name" /> // User enters 123 $_SESSION['textbox_session'] = $_POST['textbox_name']; // Page 2 session_start(); // Starts the session echo $_SESSION['textbox_session'];
I hope you know that :
The built-in $_POST function is used to collect values from a form sent with method="post".
But we are here not sending data anywhere so it is useless to use $_POST..!!! thats what i m saying from very starting..!! I have to Hold data on page refresh(without using submit or without using any event)..!!!!
Sir this time you need to research little bit..!!!
Thanks for your Kind Patience..
Last edited by nish123; May 30th, 2009 at 2:40 am.
How can you not be sending data?
The layout of your example, you would presumme it would be sending data.
If you not going to use 'post' use another 'session'.
List your code im getting tired of trying to guess what it is
The layout of your example, you would presumme it would be sending data.
If you not going to use 'post' use another 'session'.
List your code im getting tired of trying to guess what it is
"You never stop learning." - OmniX
•
•
•
•
How can you not be sending data?
The layout of your example, you would presumme it would be sending data.
If you not going to use 'post' use another 'session'.
List your code im getting tired of trying to guess what it is
PHP Syntax (Toggle Plain Text)
<form action="add.php" method="post"> <table> <tr> <td>Items</td> <td>Price</td> </tr> <tr> <? while($row=mysql_fetch_array($result)) { ?> { <td><?= $row['Item']; ?> </td> //this will fetch Item from DB.. <td><input type="text" name="price"></td> // in this text box user input the price..!! <?}?> <button type="button" onclick="return myPopup2();"><span>Add New Item</span></button></td> // This Add New Item Button will open a popup window through which I can add new Item... and on close of pop-up window the parent page will REFRESH... So that the NEW ITEM can be Displayed in the List..!!! Note : Add Button is not a Submit button.. it jst call a Javascript Function to open a Window..!!
Now i want to Hold the Value of Price TextBox which user input in it at time page refresh..!!
Suppose User got the page with 5 items...!!!
ITEMS | PRICE
ITEMS1 | 50 // Items are coming from db and User input the Price
ITEMS2 | 30
ITEMS3 | 20
ITEMS4 | 40
ITEMS5 | 60
ADD New ITEM (Button) // After Filling the Prices of First 5 Items,User Feels that He forgot to add ITEM 6 then he will Click on Add Item Button,a Popup Window Will Open through Which User Add Item 6 and on Close of that window... the Parent page will Refresh and Item 6 will displayed in the list..!!! But the values which User filled in Price textbox will be vanished...!!!
and I want to hold that Price Value on page refresh...!!!!

Now i hope clear Idea whta i want...??

I hope You reply with a Good Solution..!!
Thnk You Sir.!!!
Last edited by nish123; Jun 1st, 2009 at 2:01 am.
Ok thats better now I understand your situation abit better.
But still you get the same answer, you have tried $_SESSION and $_POST ? Im sure either one would work if $_POST does not work cause technically there has been no information sent then sessions should work. popup2() is a function that opens a new php page I gather? So you should be able to declare either $_SESSION or $_POST within the value parameters of those text boxes.
In short have you tried $_POST or $_SESSION?
or you do not know how to implement either?
But still you get the same answer, you have tried $_SESSION and $_POST ? Im sure either one would work if $_POST does not work cause technically there has been no information sent then sessions should work. popup2() is a function that opens a new php page I gather? So you should be able to declare either $_SESSION or $_POST within the value parameters of those text boxes.
In short have you tried $_POST or $_SESSION?
or you do not know how to implement either?
"You never stop learning." - OmniX
![]() |
Similar Threads
- Postback method in php (PHP)
- Show time on page without refresh?? (PHP)
- JS page refresh in FF (JavaScript / DHTML / AJAX)
- How to prevent duplicate record insertion on Page refresh using Bool variable? (C#)
- Page refresh when MySQL db changes (JavaScript / DHTML / AJAX)
- No tab/page refresh when internet options internet settings are set to never (JavaScript / DHTML / AJAX)
- delayed page refresh when link is clicked (HTML and CSS)
Other Threads in the PHP Forum
- Previous Thread: how do i do three WHERE clauses with php (mysql)
- Next Thread: PHP Dynamic links?
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array autosuggest beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email emptydisplayvalue error explodefunction file files folder form forms function functions google hack href htaccess html image include insert integration ip java javascript joomla keywords limit link login loop mail menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search searchbox select server sessions sms soap source space speed sql structure syntax system table tutorial update upload url validation validator variable video web website xml youtube






