Hi Bob!
I'v create a multipage form with 2 step.
In the first step i write the Cognome (surname)Mrtins:

When i go in the 2nd step how to have in auto the previous value of Cognome(surname)?
I'v create a multipage form with 2 step.
In the first step i write the Cognome (surname)Mrtins:

When i go in the 2nd step how to have in auto the previous value of Cognome(surname)?

HI pasqualedi,
You need to set the value from the $posted array
Bob
You need to set the value from the $posted array
<input name='cognome2' . . . value='<?php echo $posted['cognome']; ?>' />
Bob
Hi Bob!Thanks very much.
For the textbox type it's ok, working..
But if i've a dropdown selection?
Thi is my code for the dropdown:
For the textbox type it's ok, working..
But if i've a dropdown selection?
Thi is my code for the dropdown:
<div class="form_item">
<div class="form_element cf_dropdown">
<select class="cf_inputbox" id="tipocontratto" size="1" title="" name="tipocontratto">
<option value="" selected="selected">Scegli</option>
<option value="Determinato">Determinato</option>
<option value="Indeterminato">Indeterminato</option>
</select>
</div>
<div class="cfclear"></div>
</div>
Hi pasqualedi,
That needs some PHP
Bob
That needs some PHP
<?php
$tipo_options = array('Determinato' => 'Determinato', 'Indeterminato' => 'Indeterminato');
$selected = "";
$options_array = array();
foreach ( $tipo_options as $k => $v ) {
if ( $k == $posted['tipo'] ) {
$selected = "selected='selected'";
}
$options_array[] = "<option value='$k' $selected >$v</option>";
}
?>
<div class="form_item">
<div class="form_element cf_dropdown">
<select class="cf_inputbox" id="tipocontratto" size="1" title="" name="tipocontratto">
<option value="">Scegli</option>
<?php
echo implode(' ', $options_array);
?>
</select>
</div>
<div class="cfclear"></div>
Bob
Hi Bob.Thanks.
I've paste your code in my 2nd step page, but not working.
Thi is my code:
I've paste your code in my 2nd step page, but not working.
Thi is my code:
<td bgcolor="#c6d7ff"><div class="form_item">
<div class="form_element cf_dropdown">
<select class="cf_inputbox" id="tipocontratto" size="1" title="" name="tipocontratto">
<option value="" selected="selected">Scegli</option>
<option value="Determinato" >Determinato</option>
<option value="Indeterminato">Indeterminato</option>
</select>
<?php
$tipocontratto_options = array('Determinato' => 'Determinato', 'Indeterminato' => 'Indeterminato');
$selected = "";
$options_array = array();
foreach ( $tipocontratto_options as $k => $v ) {
if ( $k == $posted['tipocontratto'] ) {
$selected = "selected='selected'";
}
$options_array[] = "<option value='$k' $selected >$v</option>";
}
?>
</div>
<div class="cfclear"></div>
</div></td>
Hi pasqualedi,
That isn't my code - it got changed somewhere. Please use all of it including the later part which actually creates the options.
Bob
That isn't my code - it got changed somewhere. Please use all of it including the later part which actually creates the options.
Bob
Ok Bob!
I've paste your original code, but don't working.
I've paste your original code, but don't working.
<?php
$tipo_options = array('Determinato' => 'Determinato', 'Indeterminato' => 'Indeterminato');
$selected = "";
$options_array = array();
foreach ( $tipo_options as $k => $v ) {
if ( $k == $posted['tipo'] ) {
$selected = "selected='selected'";
}
$options_array[] = "<option value='$k' $selected >$v</option>";
}
?>
<div class="form_item">
<div class="form_element cf_dropdown">
<select class="cf_inputbox" id="tipocontratto" size="1" title="" name="tipocontratto">
<option value="">Scegli</option>
<?php
echo implode(' ', $options_array);
?>
</select>
</div>
<div class="cfclear"></div>
Hi Bob!With this cod working.
<option value="Determinato"<?php if($_POST['tipocontratto']=='Determinato') print 'selected="selected"'; ?> >Determinato</option>
<option value="Indeterminato"<?php if($_POST['tipocontratto']=='Indeterminato') print 'selected="selected"'; ?>>Indeterminato</option>
This topic is locked and no more replies can be posted.