PostBack method on Page Refresh

Reply

Join Date: Dec 2007
Posts: 622
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 9
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: PostBack method on Page Refresh

 
0
  #11
May 29th, 2009
I cant explain to you everything about sessions but I can give you an example, that will hopefully solve your problem.

  1. // PAGE 1
  2. session_start();
  3. $_SESSION['abc'] = "2";
  4.  
  5. // PAGE 2
  6. session_start();
  7. echo $_SESSION['abc];
  8.  

Understand the logic behind it now?

Let me know how you go.
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 83
Reputation: nish123 is an unknown quantity at this point 
Solved Threads: 0
nish123's Avatar
nish123 nish123 is offline Offline
Junior Poster in Training

Re: PostBack method on Page Refresh

 
0
  #12
May 29th, 2009
Originally Posted by OmniX View Post
I cant explain to you everything about sessions but I can give you an example, that will hopefully solve your problem.

  1. // PAGE 1
  2. session_start();
  3. $_SESSION['abc'] = "2";
  4.  
  5. // PAGE 2
  6. session_start();
  7. echo $_SESSION['abc];
  8.  

Understand the logic behind it now?

Let me know how you go.
yes sir i understand the code but sir value '2' is dynamic not static..!!! value can be 2,3,4 etc whatever user can input in it..!!!!

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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,721
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 500
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: PostBack method on Page Refresh

 
0
  #13
May 29th, 2009
is it possible to have Postback method on page Refresh.??
(Hold the values of a form on page refresh..!!)
You want to preserve the data or state of form input tag even after the page is posted back.

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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 622
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 9
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: PostBack method on Page Refresh

 
0
  #14
May 29th, 2009
Here is an example code for everything to solves your questions:

  1. // Page 1
  2. session_start(); // Starts the session
  3. <input type="textbox" name="textbox_name" /> // User enters 123
  4. $_SESSION['textbox_session'] = $_POST['textbox_name'];
  5.  
  6. // Page 2
  7. session_start(); // Starts the session
  8. echo $_SESSION['textbox_session'];

You understand the logic? If not do some research?
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,721
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 500
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: PostBack method on Page Refresh

 
0
  #15
May 29th, 2009
adatapost>Example code is not a solution after all. If a person is not able to program himself/herself then he/she must introspect.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 622
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 9
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: PostBack method on Page Refresh

 
0
  #16
May 29th, 2009
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.
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 83
Reputation: nish123 is an unknown quantity at this point 
Solved Threads: 0
nish123's Avatar
nish123 nish123 is offline Offline
Junior Poster in Training

Re: PostBack method on Page Refresh

 
0
  #17
May 30th, 2009
Originally Posted by OmniX View Post
Here is an example code for everything to solves your questions:
  1. // Page 1
  2. session_start(); // Starts the session
  3. <input type="textbox" name="textbox_name" /> // User enters 123
  4. $_SESSION['textbox_session'] = $_POST['textbox_name'];
  5.  
  6. // Page 2
  7. session_start(); // Starts the session
  8. echo $_SESSION['textbox_session'];
You understand the logic? If not do some research?
Sorry sir but i dont understand that why you use $_POST when you not sending any data anywhere...
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 622
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 9
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: PostBack method on Page Refresh

 
0
  #18
May 31st, 2009
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
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 83
Reputation: nish123 is an unknown quantity at this point 
Solved Threads: 0
nish123's Avatar
nish123 nish123 is offline Offline
Junior Poster in Training

Re: PostBack method on Page Refresh

 
0
  #19
Jun 1st, 2009
Originally Posted by OmniX View Post
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
Respected Sir i dont thnk my very first post was difficult to understand..!!! Now i try my best to made it more clear....!!!

  1. <form action="add.php" method="post">
  2. <table>
  3. <tr>
  4. <td>Items</td>
  5. <td>Price</td>
  6. </tr>
  7. <tr>
  8. <? while($row=mysql_fetch_array($result)) { ?>
  9. {
  10. <td><?= $row['Item']; ?> </td> //this will fetch Item from DB..
  11. <td><input type="text" name="price"></td>
  12. // in this text box user input the price..!!
  13. <?}?>
  14. <button type="button" onclick="return myPopup2();"><span>Add New Item</span></button></td>
  15.  
  16. // 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..!!!
  17.  
  18. 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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 622
Reputation: OmniX is an unknown quantity at this point 
Solved Threads: 9
OmniX's Avatar
OmniX OmniX is offline Offline
Practically a Master Poster

Re: PostBack method on Page Refresh

 
0
  #20
Jun 1st, 2009
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?
"You never stop learning." - OmniX
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC