rbragg Posted March 23, 2007 Share Posted March 23, 2007 I have many droplists that are populated with the values "open" and "closed". This one is called drop31. As with all of the droplists, which value is default is dependent on which value is currently stored in the db under "Lot31": <?php include 'db_connect.php'; $query_getStatus = mysql_query("SELECT * FROM park_lots") or die(mysql_error()); $get_status = mysql_fetch_array( $query_getStatus ); $_SESSION['status'] = array('open','closed'); echo "<select name='drop31 id='31' class='style1'>"; for ($i=0;$i<=count($_SESSION['status']);$i++) { if ($_SESSION['status'][$i] == $get_status['Lot31']) { echo "<option value=\"{$_SESSION['status'][$i]}\" selected=\"selected\">{$_SESSION['status'][$i]}</option>"; } else { echo "<option value=\"{$_SESSION['status'][$i]}\">{$_SESSION['status'][$i]}</option>"; } } echo '</select>'; ?> The user can change the the value and then upon submission is transferred to a confirmation page where the new value is displayed. This is where my problem is. How do I display the new value there via the Sessions array? I have set up the array at the top of page like so: <?php if( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['done']) ) { foreach ($_POST as $key => $value) { if ($key != "done") { $_SESSION[$key] = strip_tags($value); } } header("Location: lots_admin_result.php"); }?> I had this working before I implemented the db aspect. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.