zartzar Posted July 14, 2010 Share Posted July 14, 2010 Having trouble function tooString() { $text="<tr> <td>".$this->label."</td> <td> <select name='".$this->name."'>"; //add options to box foreach($this->options as $option) $text.="<option value='".$option."'>".$option."</option>"; $text.="</select> </td> </tr>"; return $text; } Link to comment https://forums.phpfreaks.com/topic/207736-how-do-i-make-this-drop-box-function-sticky/ Share on other sites More sharing options...
wildteen88 Posted July 14, 2010 Share Posted July 14, 2010 And your question/problem is? Link to comment https://forums.phpfreaks.com/topic/207736-how-do-i-make-this-drop-box-function-sticky/#findComment-1085962 Share on other sites More sharing options...
zartzar Posted July 14, 2010 Author Share Posted July 14, 2010 I have this fuction to generate drop boxes. How can i make the posted information sticky? Link to comment https://forums.phpfreaks.com/topic/207736-how-do-i-make-this-drop-box-function-sticky/#findComment-1085964 Share on other sites More sharing options...
wildteen88 Posted July 14, 2010 Share Posted July 14, 2010 I have this fuction to generate drop boxes. How can i make the posted information sticky? Can you define what you mean by sticky? Maybe you should explain in full what you're trying to do. Link to comment https://forums.phpfreaks.com/topic/207736-how-do-i-make-this-drop-box-function-sticky/#findComment-1085966 Share on other sites More sharing options...
zartzar Posted July 14, 2010 Author Share Posted July 14, 2010 Ok... i have this form with drop boxes and a few text boxes too. If the form is not filled out correctly i want the page to "remember" the option that was selected in the drop box Link to comment https://forums.phpfreaks.com/topic/207736-how-do-i-make-this-drop-box-function-sticky/#findComment-1085974 Share on other sites More sharing options...
wildteen88 Posted July 14, 2010 Share Posted July 14, 2010 Oh ok now I understand //add options to box foreach($this->options as $option) { $selected = (isset($_POST[$this->name]) && $_POST[$this->name] == $option) ? ' selected="selected"' : null) $text.="<option value='".$option."'{$selected}>".$option."</option>"; } Link to comment https://forums.phpfreaks.com/topic/207736-how-do-i-make-this-drop-box-function-sticky/#findComment-1085977 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.