I am working on a proces where a customer can fill in his dimensions and then can submit a form which data then will be saved in SESSION variables and will be displayed on the page, so the customer can watch his configuration.
I save my submit in $_SESSION['wz_submit_saving_1'] and use an If statement to check if the form is submitted so the config can be displayed.
<?php // Save submit
$wz_submit_saving_1 = $_POST['wz_submit_saving_1'];
$_SESSION['wz_submit_saving_1'] = $wz_submit_saving_1;
if(isset($_SESSION['wz_submit_saving_1'])) :
// Save wz_saving_a in session
$wz_saving_a = $_POST['wz_saving_a'];
$_SESSION['wz_saving_a'] = $wz_saving_a;
// Save wz_saving_b in session
$wz_saving_b = $_POST['wz_saving_b'];
$_SESSION['wz_saving_b'] = $wz_saving_b;
endif; ?>
My problem is that if I use if(isset($_SESSION['wz_submit_saving_1'])) for showing the config, it displays well after submit, but if I refresh the page the config is gone.
If I use if(isset($_SESSION['wz_saving_a'])) (the a dimension field) and refresh the page, the config is almost there. But I want to use the saved submit session variable for checking if the form is submitted. Can someone tell me what I am doing wrong?
<?php if(isset($_SESSION['wz_submit_saving_1'])) : ?>
<div id="wz_config_1" class="wz_config">
<ul>
<li>Dimensions</li>
<li>A: <?php if(isset($_SESSION['wz_saving_a'])) : echo $_SESSION['wz_saving_a']; endif; ?></li>
<li>B: <?php if(isset($_SESSION['wz_saving_b'])) : echo $_SESSION['wz_saving_b']; endif; ?></li>
</ul>
</div><!--End wz_config_1-->
<?php endif; ?>
The form:
<form method="POST">
<label>A</label>
<input name="wz_saving_a" type="text" />
<label>B</label>
<input name="wz_saving_b" type="text" />
<input name="wz_submit_saving_1" type="submit" class="add_button" value="Add" />
</form>