comodo Posted October 16, 2012 Share Posted October 16, 2012 Hi! I have questionary page where people must select some values but it doesn't remember the selected values when you go back to edit. I select and save but it goes back to I am new in PHP ,sorry Code: <tr> <td width="100" align="right" class="key"><?php echo JText::_( 'Staatus' ); ?>: </label></td> <td><select name="proforma" id="proforma"> <?php $Noproforma = " "; $proforma = " "; ?> <option> </option> <option <?php echo $proforma;?> value="NoProforma"><?php echo JText::_('NoProforma');?></option> <option <?php echo $proforma;?> value="Proforma"><?php echo JText::_('Proforma');?></option> </select></td> </tr> Quote Link to comment https://forums.phpfreaks.com/topic/269516-selectbox/ Share on other sites More sharing options...
White_Lily Posted October 16, 2012 Share Posted October 16, 2012 Have you tried spelling "Staatus" (Status) correctly? Quote Link to comment https://forums.phpfreaks.com/topic/269516-selectbox/#findComment-1385468 Share on other sites More sharing options...
Christian F. Posted October 16, 2012 Share Posted October 16, 2012 That has no bearing on the problem, and not a problem at all. staatus is the label, which is showing. The problem at hand is two-sided: The browser does not keep the form details in the history, so when you go back in the history it'll show the form as sent by the server. Your users have to go back in the history to edit the details, instead of you adding the user-inputted data into the form and show it anew. Alongside the error message. Quote Link to comment https://forums.phpfreaks.com/topic/269516-selectbox/#findComment-1385521 Share on other sites More sharing options...
JohnTipperton Posted October 18, 2012 Share Posted October 18, 2012 create a session variable for your first submission. $selectedvalue = $_SESSION['selectedvalue']; and in the select box you must include a selected="selected" there for the code should be like <option <?php echo $selectedvalue;?> value="<?php $selectedvalue ?>" selected="selected"><?php echo $selectedvalue></option> <option <?php echo $proforma;?> value="NoProforma"><?php echo JText::_('NoProforma');?></option> Quote Link to comment https://forums.phpfreaks.com/topic/269516-selectbox/#findComment-1386064 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.