nwduckett Posted August 3, 2011 Share Posted August 3, 2011 Hi everyone, I have two select boxes on a form one created from contents in a folder and another with 4 options. when i submit the form, the values reset to default how can i get them to stay on the selected choice after submit (save). Here are the two select boxes below: <label for="<?php echo $this->get_field_id('image1'); ?>"> <?php $path = "/"; //change this if the script is in a different dir that the files you want $show = array( '.jpg', '.gif', '.png' ); //Type of files to show $select = "<select class=\"widefat\" name=\"widget-scr[3][image1]\" value=\"".$instance['image1']."\">"; $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ $ext=substr($file,-4,4); if(in_array( $ext, $show )){ $select .= "<option value='$file'>$file</option>\n"; } } $select .= "</select>"; closedir( $dh ); echo "$select"; ?> </label> <label for="<?php echo $this->get_field_id('anchor1'); ?>"> <?php _e('Anchor:'); ?> <select class="widefat" name="<?php echo $this->get_field_name('anchor1'); ?>"><option name="1">1</option><option name="2">2</option><option name="3">3</option><option name="4">4</option></select> </label> I am a beginner at php so I will need good instructions. Thanks Nathan Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 3, 2011 Share Posted August 3, 2011 you need to add 'selected' like this: $select .= "<option value='$file' selected>$file</option>\n"; so, basically, when you're looping through and building the dropdown menu, you compare the value with the one that was posted, and add ' selected' if necessary: $select .= '<option value="'.$file.'"; if($_POST['your_var_name'] == $file) $select .= ' selected'; $select .= '>'.$file.'</option>'; Quote Link to comment Share on other sites More sharing options...
nwduckett Posted August 4, 2011 Author Share Posted August 4, 2011 Hi WebStyles, I am a beginner so please bear with me, (note: this script for selecting list of files from a folder and creating a drop down box was taken from a help forum and i have altered it slightly.) Where do i place the if statement in my code also 'your_var_name' what variable do i need to add in here? Thanks for your help Nathan Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 4, 2011 Share Posted August 4, 2011 you place the if statement just like I showed you in my example. your_var_here needs to have the value you put into name="whatever" when you create your <select... box.. Quote Link to comment Share on other sites More sharing options...
nwduckett Posted August 5, 2011 Author Share Posted August 5, 2011 Hello again good morning. <label for="<?php echo $this->get_field_id('image1'); ?>"> <?php $path = "C:/wamp/www/newjobboard/banners"; //change this if the script is in a different dir that the files you want $show = array( '.jpg', '.gif', '.png' ); //Type of files to show $select = "<select class=\"widefat\" name=\"widget-scr[3][image1]\" value=\"".$instance['image1']."\">"; $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ $ext=substr($file,-4,4); if(in_array( $ext, $show )){ $select .= '<option value="'.$file.'"; if($_POST['widget-scr[3][image1]'] == $file) $select .= 'selected'; $select .= '>'.$file.'</option>'; } } $select .= "</select>"; closedir( $dh ); echo "$select"; ?> </label> I get Parse error: syntax error, unexpected T_STRING on line (15 0n the code provide) Any hints thanks Nathan Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 5, 2011 Share Posted August 5, 2011 instead of this: if($_POST['widget-scr[3][image1]'] == $file) $select .= 'selected'; try something like this: if($_POST['widget-scr'][3]['image1'] == $file) $select .= 'selected'; Quote Link to comment Share on other sites More sharing options...
nwduckett Posted August 5, 2011 Author Share Posted August 5, 2011 Still getting the same error so I will paste my full code and explain what I am trying to do: It is a widget for wordpress. I have modified it so it my be long, there may be a shorter way of doing it but it works for now so its a start. So the form works without adding the selected bit of code. it is line 159 to line 162 where i have tried to add your code. <?php // Inspired by the built-in WP_Widget_Text class class WP_Widget_Schoolscr extends WP_Widget { // Set up the widget classname and description function WP_Widget_Schoolscr() { $widget_ops = array('classname' => 'widget_text', 'description' => __('Adds "schools currently recruiting"')); $control_ops = array(); $this->WP_Widget('scr', __('Schools currently recruiting'), $widget_ops, $control_ops); } // Display the widget on the web site function widget( $args, $instance ) { extract($args); // displays the image, text and links if the form is completed if ($instance['url1']) { $add_image1 = "<p><img src=\"banners/".$instance['image1']."\" alt=\"".$instance['alt1']."\" style=\"float:left;\" />"; $add_company1 = "".$instance['company1']."<br />"; $add_location1 = $instance['location1']; $add_url1 = "<br /><a href=\"".$instance['url1']."\">".$instance['anchor1']."</a></p>"; } if ($instance['url2']) { $add_image2 = "<br /><p><img src=\"banners/".$instance['image2']."\" alt=\"".$instance['alt2']."\" style=\"float:left;\" />"; $add_company2 = "".$instance['company2']."<br />"; $add_location2 = $instance['location2']; $add_url2 = "<br /><a href=\"".$instance['url2']."\">".$instance['anchor2']."</a></p>"; } if ($instance['url3']) { $add_image3 = "<br /><p><img src=\"banners/".$instance['image3']."\" alt=\"".$instance['alt3']."\" style=\"float:left;\" />"; $add_company3 = "".$instance['company3']."<br />"; $add_location3 = $instance['location3']; $add_url3 = "<br /><a href=\"".$instance['url3']."\">".$instance['anchor3']."</a></p>"; } if ($instance['url4']) { $add_image4 = "<br /><p><img src=\"banners/".$instance['image4']."\" alt=\"".$instance['alt4']."\" style=\"float:left;\" />"; $add_company4 = "".$instance['company4']."<br />"; $add_location4 = $instance['location4']; $add_url4 = "<br /><a href=\"".$instance['url4']."\">".$instance['anchor4']."</a></p>"; } if ($instance['url5']) { $add_image5 = "<br /><p><img src=\"banners/".$instance['image5']."\" alt=\"".$instance['alt5']."\" style=\"float:left;\" />"; $add_company5 = "".$instance['company5']."<br />"; $add_location5 = $instance['location5']; $add_url5 = "<br /><a href=\"".$instance['url5']."\">".$instance['anchor5']."</a></p>"; } if ($instance['url6']) { $add_image6 = "<br /><p><img src=\"banners/".$instance['image6']."\" alt=\"".$instance['alt6']."\" style=\"float:left;\" />"; $add_company6 = "".$instance['company6']."<br />"; $add_location6 = $instance['location6']; $add_url6 = "<br /><a href=\"".$instance['url6']."\">".$instance['anchor6']."</a></p>"; } echo $before_widget; ?> <h3>Schools Currently Recruiting<span> </span></h3> <div class="textwidget"> <?php echo $add_image1; ?> <?php echo $add_company1; ?> <?php echo $add_location1; ?> <?php echo $add_url1; ?> <?php echo $add_image2; ?> <?php echo $add_company2; ?> <?php echo $add_location2; ?> <?php echo $add_url2; ?> <?php echo $add_image3; ?> <?php echo $add_company3; ?> <?php echo $add_location3; ?> <?php echo $add_url3; ?> <?php echo $add_image4; ?> <?php echo $add_company4; ?> <?php echo $add_location4; ?> <?php echo $add_url4; ?> <?php echo $add_image5; ?> <?php echo $add_company5; ?> <?php echo $add_location5; ?> <?php echo $add_url5; ?> <?php echo $add_image6; ?> <?php echo $add_company6; ?> <?php echo $add_location6; ?> <?php echo $add_url6; ?> </div> <?php echo $after_widget; } // Save the settings for this instance function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['image1'] = strip_tags($new_instance['image1']); $instance['alt1'] = strip_tags($new_instance['alt1']); $instance['company1'] = strip_tags($new_instance['company1']); $instance['location1'] = strip_tags($new_instance['location1']); $instance['url1'] = strip_tags($new_instance['url1']); $instance['anchor1'] = strip_tags($new_instance['anchor1']); $instance['image2'] = strip_tags($new_instance['image2']); $instance['alt2'] = strip_tags($new_instance['alt2']); $instance['company2'] = strip_tags($new_instance['company2']); $instance['location2'] = strip_tags($new_instance['location2']); $instance['url2'] = strip_tags($new_instance['url2']); $instance['anchor2'] = strip_tags($new_instance['anchor2']); $instance['image3'] = strip_tags($new_instance['image3']); $instance['alt3'] = strip_tags($new_instance['alt3']); $instance['company3'] = strip_tags($new_instance['company3']); $instance['location3'] = strip_tags($new_instance['location3']); $instance['url3'] = strip_tags($new_instance['url3']); $instance['anchor3'] = strip_tags($new_instance['anchor3']); $instance['image4'] = strip_tags($new_instance['image4']); $instance['alt4'] = strip_tags($new_instance['alt4']); $instance['company4'] = strip_tags($new_instance['company4']); $instance['location4'] = strip_tags($new_instance['location4']); $instance['url4'] = strip_tags($new_instance['url4']); $instance['anchor4'] = strip_tags($new_instance['anchor4']); $instance['image5'] = strip_tags($new_instance['image5']); $instance['alt5'] = strip_tags($new_instance['alt5']); $instance['company5'] = strip_tags($new_instance['company5']); $instance['location5'] = strip_tags($new_instance['location5']); $instance['url5'] = strip_tags($new_instance['url5']); $instance['anchor5'] = strip_tags($new_instance['anchor5']); $instance['image6'] = strip_tags($new_instance['image6']); $instance['alt6'] = strip_tags($new_instance['alt6']); $instance['company6'] = strip_tags($new_instance['company6']); $instance['location6'] = strip_tags($new_instance['location6']); $instance['url6'] = strip_tags($new_instance['url6']); $instance['anchor6'] = strip_tags($new_instance['anchor6']); return $instance; } // Display the widget form in the admin interface function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'image' => '', 'alt' => '', 'company' => '', 'location' => '', 'url' => '' ) ); ?> <?php // Hidden title field for the admin interface to display ?> <input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="hidden" value="<?php echo $title; ?>" /> <h3>School 1</h3> <p> <label for="<?php echo $this->get_field_id('image1'); ?>"> <?php $path = "C:/wamp/www/newjobboard/banners"; //change this if the script is in a different dir that the files you want $show = array( '.jpg', '.gif', '.png' ); //Type of files to show $select = "<select class=\"widefat\" name=\"widget-scr[3][image1]\" value=\"".$instance['image1']."\">"; $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ $ext=substr($file,-4,4); if(in_array( $ext, $show )){ $select .= '<option value="'.$file.'"; if($_POST['widget-scr']['3']['image1'] == $file) $select .= 'selected'; $select .= '>'.$file.'</option>'; } } $select .= "</select>"; closedir( $dh ); echo "$select"; ?> </label> <br /> <label for="<?php echo $this->get_field_id('alt1'); ?>"> <?php _e('Alternate Text:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('alt1'); ?>" name="<?php echo $this->get_field_name('alt1'); ?>" type="text" value="<?php echo $instance['alt1']; ?>" /> <small><?php _e( 'Shown if image cannot be displayed' ); ?></small> </label> <br /> <label for="<?php echo $this->get_field_id('company1'); ?>"> <?php _e('Company:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('company1'); ?>" name="<?php echo $this->get_field_name('company1'); ?>" type="text" value="<?php echo $instance['company1']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('location1'); ?>"> <?php _e('Location:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('location1'); ?>" name="<?php echo $this->get_field_name('location1'); ?>" type="text" value="<?php echo $instance['location1']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('url1'); ?>"> <?php _e('Url:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('url1'); ?>" name="<?php echo $this->get_field_name('url1'); ?>" type="text" value="<?php echo $instance['url1']; ?>" /> <small><?php _e( 'Please include full url (http://www.eg.com)' ); ?></small> </label> <label for="<?php echo $this->get_field_id('anchor1'); ?>"> <?php _e('Anchor:'); ?> <select class="widefat" name="<?php echo $this->get_field_name('anchor1'); ?>"><option name="1">Latest TEFL Jobs London</option><option name="2">Latest Summer TEFL Jobs</option><option name="3">Latest UK Jobs</option><option name="4">Latest TEFL Jobs</option></select> </label> </p> <h3>School 2</h3> <p> <label for="<?php echo $this->get_field_id('image2'); ?>"> <?php $path = "C:/wamp/www/newjobboard/banners"; //change this if the script is in a different dir that the files you want $show = array( '.jpg', '.gif', '.png' ); //Type of files to show $select = "<select class=\"widefat\" name=\"widget-scr[3][image2]\" value=\"".$instance['image2']."\">"; $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ $ext=substr($file,-4,4); if(in_array( $ext, $show )){ $select .= "<option value='$file'>$file</option>\n"; } } $select .= "</select>"; closedir( $dh ); echo "$select"; ?> </label> <br /> <label for="<?php echo $this->get_field_id('alt2'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('alt2'); ?>" name="<?php echo $this->get_field_name('alt2'); ?>" type="text" value="<?php echo $instance['alt2']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('company2'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('company2'); ?>" name="<?php echo $this->get_field_name('company2'); ?>" type="text" value="<?php echo $instance['company2']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('location2'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('location2'); ?>" name="<?php echo $this->get_field_name('location2'); ?>" type="text" value="<?php echo $instance['location2']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('url2'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('url2'); ?>" name="<?php echo $this->get_field_name('url2'); ?>" type="text" value="<?php echo $instance['url2']; ?>" /> </label> <label for="<?php echo $this->get_field_id('anchor2'); ?>"> <?php _e('Anchor:'); ?> <select class="widefat" name="<?php echo $this->get_field_name('anchor2'); ?>"><option name="1">Latest TEFL Jobs London</option><option name="2">Latest Summer TEFL Jobs</option><option name="3">Latest UK Jobs</option><option name="4">Latest TEFL Jobs</option></select> </label> </p> <h3>School 3</h3> <p> <label for="<?php echo $this->get_field_id('image3'); ?>"> <?php $path = "C:/wamp/www/newjobboard/banners"; //change this if the script is in a different dir that the files you want $show = array( '.jpg', '.gif', '.png' ); //Type of files to show $select = "<select class=\"widefat\" name=\"widget-scr[3][image3]\" value=\"".$instance['image3']."\">"; $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ $ext=substr($file,-4,4); if(in_array( $ext, $show )){ $select .= "<option value='$file'>$file</option>\n"; } } $select .= "</select>"; closedir( $dh ); echo "$select"; ?> </label> <br /> <label for="<?php echo $this->get_field_id('alt3'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('alt3'); ?>" name="<?php echo $this->get_field_name('alt3'); ?>" type="text" value="<?php echo $instance['alt3']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('company3'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('company3'); ?>" name="<?php echo $this->get_field_name('company3'); ?>" type="text" value="<?php echo $instance['company3']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('location3'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('location3'); ?>" name="<?php echo $this->get_field_name('location3'); ?>" type="text" value="<?php echo $instance['location3']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('url3'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('url3'); ?>" name="<?php echo $this->get_field_name('url3'); ?>" type="text" value="<?php echo $instance['url3']; ?>" /> </label> <label for="<?php echo $this->get_field_id('anchor3'); ?>"> <?php _e('Anchor:'); ?> <select class="widefat" name="<?php echo $this->get_field_name('anchor3'); ?>"><option name="1">Latest TEFL Jobs London</option><option name="2">Latest Summer TEFL Jobs</option><option name="3">Latest UK Jobs</option><option name="4">Latest TEFL Jobs</option></select> </label> </p> <h3>School 4</h3> <p> <label for="<?php echo $this->get_field_id('image4'); ?>"> <?php $path = "C:/wamp/www/newjobboard/banners"; //change this if the script is in a different dir that the files you want $show = array( '.jpg', '.gif', '.png' ); //Type of files to show $select = "<select class=\"widefat\" name=\"widget-scr[3][image4]\" value=\"".$instance['image4']."\">"; $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ $ext=substr($file,-4,4); if(in_array( $ext, $show )){ $select .= "<option value='$file'>$file</option>\n"; } } $select .= "</select>"; closedir( $dh ); echo "$select"; ?> </label> <br /> <label for="<?php echo $this->get_field_id('alt4'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('alt4'); ?>" name="<?php echo $this->get_field_name('alt4'); ?>" type="text" value="<?php echo $instance['alt4']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('company4'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('company4'); ?>" name="<?php echo $this->get_field_name('company4'); ?>" type="text" value="<?php echo $instance['company4']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('location4'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('location4'); ?>" name="<?php echo $this->get_field_name('location4'); ?>" type="text" value="<?php echo $instance['location4']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('url4'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('url4'); ?>" name="<?php echo $this->get_field_name('url4'); ?>" type="text" value="<?php echo $instance['url4']; ?>" /> </label> <label for="<?php echo $this->get_field_id('anchor4'); ?>"> <?php _e('Anchor:'); ?> <select class="widefat" name="<?php echo $this->get_field_name('anchor4'); ?>"><option name="1">Latest TEFL Jobs London</option><option name="2">Latest Summer TEFL Jobs</option><option name="3">Latest UK Jobs</option><option name="4">Latest TEFL Jobs</option></select> </label> </p> <h3>School 5</h3> <p> <label for="<?php echo $this->get_field_id('image5'); ?>"> <?php $path = "C:/wamp/www/newjobboard/banners"; //change this if the script is in a different dir that the files you want $show = array( '.jpg', '.gif', '.png' ); //Type of files to show $select = "<select class=\"widefat\" name=\"widget-scr[3][image5]\" value=\"".$instance['image5']."\">"; $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ $ext=substr($file,-4,4); if(in_array( $ext, $show )){ $select .= "<option value='$file'>$file</option>\n"; } } $select .= "</select>"; closedir( $dh ); echo "$select"; ?> </label> <br /> <label for="<?php echo $this->get_field_id('alt5'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('alt5'); ?>" name="<?php echo $this->get_field_name('alt5'); ?>" type="text" value="<?php echo $instance['alt5']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('company5'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('company5'); ?>" name="<?php echo $this->get_field_name('company5'); ?>" type="text" value="<?php echo $instance['company5']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('location5'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('location5'); ?>" name="<?php echo $this->get_field_name('location5'); ?>" type="text" value="<?php echo $instance['location5']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('url5'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('url5'); ?>" name="<?php echo $this->get_field_name('url5'); ?>" type="text" value="<?php echo $instance['url5']; ?>" /> </label> <label for="<?php echo $this->get_field_id('anchor5'); ?>"> <?php _e('Anchor:'); ?> <select class="widefat" name="<?php echo $this->get_field_name('anchor5'); ?>"><option name="1">Latest TEFL Jobs London</option><option name="2">Latest Summer TEFL Jobs</option><option name="3">Latest UK Jobs</option><option name="4">Latest TEFL Jobs</option></select> </label> </p> <h3>School 6</h3> <p> <label for="<?php echo $this->get_field_id('image6'); ?>"> <?php $path = "C:/wamp/www/newjobboard/banners"; //change this if the script is in a different dir that the files you want $show = array( '.jpg', '.gif', '.png' ); //Type of files to show $select = "<select class=\"widefat\" name=\"widget-scr[3][image6]\" value=\"".$instance['image6']."\">"; $dh = @opendir( $path ); while( false !== ( $file = readdir( $dh ) ) ){ $ext=substr($file,-4,4); if(in_array( $ext, $show )){ $select .= "<option value='$file'>$file</option>\n"; } } $select .= "</select>"; closedir( $dh ); echo "$select"; ?> </label> <br /> <label for="<?php echo $this->get_field_id('alt6'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('alt6'); ?>" name="<?php echo $this->get_field_name('alt6'); ?>" type="text" value="<?php echo $instance['alt6']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('company6'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('company6'); ?>" name="<?php echo $this->get_field_name('company6'); ?>" type="text" value="<?php echo $instance['company6']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('location6'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('location6'); ?>" name="<?php echo $this->get_field_name('location6'); ?>" type="text" value="<?php echo $instance['location6']; ?>" /> </label> <br /> <label for="<?php echo $this->get_field_id('url6'); ?>"> <input class="widefat" id="<?php echo $this->get_field_id('url6'); ?>" name="<?php echo $this->get_field_name('url6'); ?>" type="text" value="<?php echo $instance['url6']; ?>" /> </label> <label for="<?php echo $this->get_field_id('anchor6'); ?>"> <?php _e('Anchor:'); ?> <select class="widefat" name="<?php echo $this->get_field_name('anchor6'); ?>"><option name="1">Latest TEFL Jobs London</option><option name="2">Latest Summer TEFL Jobs</option><option name="3">Latest UK Jobs</option><option name="4">Latest TEFL Jobs</option></select> </label> </p> <?php } } // Init function for registering the widget function widget_text_init() { register_widget('WP_Widget_Schoolscr'); } add_action('init', 'widget_text_init', 1); ?> Might look messy to you Thanks Nathan Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 5, 2011 Share Posted August 5, 2011 $select .= '<option value="'.$file.'"; should be: $select .= '<option value="'.$file.'"'; (missing a single quote on the end) Quote Link to comment Share on other sites More sharing options...
nwduckett Posted August 5, 2011 Author Share Posted August 5, 2011 thanks for the super fast reply, that works thanks, after clicking save the file selected stays selected. But on page refresh or when i come back to the page (wordpress widget page) the selected option goes back to the first option in the dropdown box (default). Is there something else i need to add to get it to stay selected on refresh or when i come back? Thanks Nathan Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 5, 2011 Share Posted August 5, 2011 it's being sent through POST, so if you access the page without submitting the form, it will not be present. what you could do to solve that is place it in a session variable, so it will always exist. 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.