retain input data on page reload

Reply

Join Date: Jun 2008
Posts: 2
Reputation: bluerain25 is an unknown quantity at this point 
Solved Threads: 0
bluerain25 bluerain25 is offline Offline
Newbie Poster

retain input data on page reload

 
0
  #1
Nov 14th, 2008
hi guys,

somebody help me please i need to know how to retain any input on page reload. I have 2 chained combo box (province and city) when a user choose a province, the next combobox should be populated. I use a script that reload the form to execute a query that filters the cities under that province. I was able to do that but the input data were gone on reload. do anyone have a sample code that will retain all the input data?

thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: retain input data on page reload

 
0
  #2
Nov 15th, 2008
put it in a session variable.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 19
Reputation: hakimkal is an unknown quantity at this point 
Solved Threads: 4
hakimkal hakimkal is offline Offline
Newbie Poster

Re: retain input data on page reload

 
0
  #3
Nov 15th, 2008
Hey, It is easier if you show us a sample of your script source, so we could help. However

Assuming I have this two elements


<form action="<php echo $_SERVER[PHP_SELF] ; ?>" method="post">



<select name = "cboCity">
<option selected="selected" value="-1"> Choose City</option>
<option value="Ohio" >Ohio</option>
<option value="Denver">Denver</option>
</select>

<input type="submit" name="push" value="submit">
</form>

Then my Php code may look like:
<?php
require "form_class.php" ;

if(array_key_exists("push",$_pos,)){
if($_POST["cboCity"] == "-1")){

echo "<div id='error'> You have not selected a city!</div>";
//Call my Print form function
$formdisp = new form ;
$formdisp ->displayform($_POST["cboCity"]) ;


}

}

?>

I am been a bit OOP Compliant here and assume that you have a form class which you created and invoke. don't mind my MVC paradigm.

hope this helps else post ur script for me here.
Reply With Quote Quick reply to this message  
Reply

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



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC