Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP drop down return to previous selection
    text
    copied!<p>Ok this is a very small section of my original code. I have two pages a page full of forms and boxes then another page that puts the information into my DB. </p> <p>Oasis.php page This right here is the code that changes the client name and code. On this entire page. On the change event.</p> <pre><code>$sql = "SELECT * FROM client_lookup ORDER BY Client_Full_Name ASC"; $result = mysql_db_query ($dbName, $sql, $dbLink); $options4=""; while ($row = mysql_fetch_array($result)) { $id=$row["Client_Code"]; $thing=$row["Client_Full_Name"]; $options4.="&lt;OPTION VALUE=\"$id, $thing\"&gt;".$thing; } ?&gt; &lt;FORM name="form" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST"&gt; &lt;SELECT NAME="ClientNamefour" OnChange="this.form.submit()"&gt; &lt;OPTION VALUE=0&gt;Client &lt;?php echo $options4?&gt; &lt;/SELECT&gt; &lt;/FORM&gt; </code></pre> <p>Once the form below this on the Oasis.php page is submitted it goes to the process page and puts the information into my data base. Once that is done I have a header that returns me to this page. But as default the Client is always returned. </p> <p>In an attempt to return the previously selected client from this drop down I used this code. To automatically select the last selected client.</p> <pre><code>$sql = "SELECT * FROM client_lookup ORDER BY Client_Full_Name ASC"; $result = mysql_db_query ($dbName, $sql, $dbLink); session_start(); $current = isset($_SESSION['ClientNamefour']) ? $_SESSION['ClientNamefour'] : 0; $options4=""; while ($row = mysql_fetch_array($result)) { $id = $row["Client_Code"]; $value = $row["Client_Full_Name"]; $key = "$id, $value"; $selected = ($id == @$_SESSION['ClientNamefour']) ? ' selected' : ''; $options4.="&lt;option value=\"{$key}\"{$selected}&gt;{$value}"; } ?&gt; &lt;FORM name="form" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST"&gt; &lt;SELECT NAME="ClientNamefour" OnChange="this.form.submit()"&gt; &lt;OPTION VALUE=0&gt;Client &lt;?php echo $options4?&gt; &lt;/SELECT&gt; &lt;/FORM&gt; </code></pre> <p>This works but the onchange event doesn't not work! So it doesn't Post itself. The on change event is key or my whole page doesn't populate with information.</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