Jump to content

Recommended Posts

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 post-132766-0-32408300-1350378471_thumb.jpg and save but it goes back to post-132766-0-97784700-1350378541_thumb.jpg

 

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>

Link to comment
https://forums.phpfreaks.com/topic/269516-selectbox/
Share on other sites

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:

  1. 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.
  2. 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.

Link to comment
https://forums.phpfreaks.com/topic/269516-selectbox/#findComment-1385521
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/269516-selectbox/#findComment-1386064
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.