I have a form as below on a page pricelist.php. On submit, it uses the code in submit.php to print a price next to the form on pricelist.php depending on the choices submitted in the form. On submit, I need the values of the first two fields to be retained. Is there a way to do this?
pricelist.php form code snippet...

                                        <form id="myForm2" method="post" enctype="multipart/form-data" > 
                                          <p class="white">HOW MANY YEARBOOKS DO YOU NEED?</p>
                                          <input  class="color4 center" style="font-size: 16px; " name="copies" id="copies" size="6"  
                                         value="<?php echo htmlspecialchars($copies); ?>" /><br /><br />  

                                          <p class="white">HOW MANY PAGES IN EACH YEARBOOK?</p>
                                          <input  class="color4 center" style="font-size: 16px; " name="pages" id="pages" size="6" />

                                          <br /> <br />  
                                        <div class="funkyradio pt0 mt0 conditional"> 
                                              <p class="white pb0 mb0">PLEASE SELECT THE STYLE OF YEARBOOK YOU WANT</p>                                   
                                              <div class="funkyradio-default">
                                                  <input  type="radio" name="cover" id="radio1" value="soft" />
                                                  <label for="radio1">SOFTBACK</label>
                                              </div>
                                              <div class="funkyradio-default">
                                                  <input   type="radio" name="cover" id="radio2" value="hb" />
                                                  <label for="radio2">LEATHERETTE HARDBACK</label>
                                              </div>
                                              <div class="funkyradio-default">
                                                  <input type="radio" name="cover" id="radio3" value="hbdc" />
                                                  <label for="radio3">LEATHERETTE HARDBACK &amp; DUSTCOVER</label>
                                              </div>
                                              <div class="funkyradio-default">
                                                  <input type="radio" name="cover" id="radio4" value="hbprint" />
                                                  <label for="radio4">LAMINATED HARDBACK</label>
                                              </div>
                                        </div>
                                    </div>
                                    <div class="col-md-5">
                                            <div class="conditional p50" data-cond-option="cover" data-cond-value="soft" > 
                                                 <img  class="img-responsive"  src="images/yearbook-min.png" />
                                            </div>
                                            <div class="conditional p50" data-cond-option="cover" data-cond-value="hb"> 
                                                  <img class="img-responsive" src="images/yearbook-option3-min.png" />
                                            </div>
                                            <div class="conditional p50" data-cond-option="cover" data-cond-value="hbdc"> 
                                                  <img class="img-responsive" src="images/yearbook-option4-min.png" />
                                            </div>
                                            <div class="conditional p50" data-cond-option="cover" data-cond-value="hbprint"> 
                                                  <img class="img-responsive" src="images/yearbook-option2-min.png" />
                                            </div>  
                                    </div>
                          </div>
                          <input type="button" id="submitFormData" class="btn-orange p10 m10 ml0" style="font-weight: bold; border-radius: 10px;" 
                                onclick="SubmitFormData2();" value="SHOW MY QUOTE" />
                          </form>

submit.php code snippet

                      echo'<h3 class="white">YOU SELECTED...</h3><br />
                                                  <p class="white" style="font-size: 1.5em"><span class="color1"><b>COVER: </b></span>'.$coverdisplay.'</p><br />
                                                  <p class="white" style="font-size: 1.5em"><span class="color1"><b>PAGES: </b></span>'.$pages.'</p> <br />
                                                  <p class="white" style="font-size: 1.5em"><span class="color1"><b>COPIES: </b></span>'.$copies.'</p> <br /><br />
                                                  <p class="color1" style="font-size: 2em"><b>PRICE PER YEARBOOK: </b><span class="white">&pound;'.$yearbookprice.'</span></p>
                                              <br />
                                                <a class="btn btn-primary  btn btn-orange" 
                                                        href="send-sample.php?cover='.$coverdisplay.'&amp;pages='.$pages.'&amp;copies='.$copies.'&amp;price='.$yearbookprice.'" 
                                                        role="button" style="font-weight: bold; border-radius: 10px;" >SEND ME THIS QUOTE AND A SAMPLE YEARBOOK</a>

I'm not sure if I hear your question straight. Are you saying on submit you don't want to submit the first two fields values or you want to also keep it for later use?

Sorry, I wasn't too clear in my post. What I meant was that I want all the values to submit but that when a user fills in the form the values in the first two fields (the number of yearbooks and the number of pages in each yearbook) need to be retained so that if the user wants to see the price of another type of yearbook, they don't have to fill in the values for the number of yearbooks and pages over again.

Retaining values across 'pages' requires storage. The usual method is session data usually stored in variables... $_SESSION['somename'].

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.