Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to stop redrawing of webpage
    text
    copied!<p>I have created a webpage using php and mysql, the code works fine except the problem is I have included so many submit buttons and hence my webpage gets redrawn many times. I lose some values i.e. $emirate value and $areas value. I used a variable $choice for storing those values but since the page is being redrawn, I don't get the values. Help me please.</p> <pre><code>$data = mysql_query("SELECT * FROM emirate") or die(mysql_error()); $choice=""; Print "&lt;table border cellpadding=3&gt;"; print"&lt;tr&gt;&lt;th&gt;&lt;form method=get action=''&gt;&lt;select id=EMIRATE size=1 name='EMIRATE' class='comboBoo'&gt;"; while($info = mysql_fetch_array( $data )) { Print "&lt;option value=". $info['em_name'] ."&gt;".$info['em_name']."&lt;/option&gt;"; } print"&lt;/select&gt;&lt;input type=submit value=OK&gt;&lt;/form&gt;&lt;/th&gt;"; if(isset($_GET['EMIRATE'])){ $emirate=$_GET['EMIRATE']; $choice.=$emirate; $data = mysql_query("SELECT a_name FROM areas where em_id=(select em_id from emirate where em_name=\"".$emirate."\")") or die(mysql_error()); Print "&lt;th&gt;&lt;form method=get action=''&gt;&lt;select id='AREAS' name=AREAS size=1 class='comboBoo'&gt;&lt;OPTION value=ALL&gt;ALL&lt;/option&gt;&lt;OPTION value=ALL&gt;ALL&lt;/option&gt;"; while($info = mysql_fetch_array( $data )) { Print "&lt;option &gt;".$info['a_name']."&lt;/option&gt;"; } print"&lt;/select&gt;&lt;input type=submit value=OK&gt;&lt;/form&gt;&lt;/th&gt;"; } $choice.="-&gt;"; if(isset($_GET['AREAS'])){ $areas=$_GET['AREAS']; $choice.=$areas; $data = mysql_query("SELECT h_name FROM hypermarket_em where a_id=(select a_id from areas where a_name=\"".$areas."\")") or die(mysql_error()); Print "&lt;th&gt;&lt;form method=get action=''&gt;&lt;select name=HYPERMARKETS size=1 class='comboBoo'&gt;"; while($info = mysql_fetch_array( $data )) { Print "&lt;option&gt;".$info['h_name']."&lt;/option&gt;"; } print"&lt;/select&gt;&lt;input type=submit value=OK&gt;&lt;/form&gt;&lt;/th&gt;"; } Print "&lt;/tr&gt;&lt;/table&gt;"; Print "&lt;table border cellpadding=3&gt;&lt;tr&gt;&lt;th&gt;".$choice."&lt;/th&gt;&lt;/tr&gt;&lt;/table&gt;"; </code></pre> <p>how can i retain them??</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload